whereIn('target_id', $resId) ->get(); $notifications = []; foreach ($watches as $watch) { $notifications[] = [ 'id' => Str::uuid(), 'from' => $from, 'to' => $watch->user_id, 'url' => '', 'content' => $message, 'res_type' => $watch->target_type, 'res_id' => $watch->target_id, 'channel' => Str::uuid(), 'created_at' => now(), 'updated_at' => now(), ]; } Log::debug('notification insert', ['data' => $notifications]); $new = Notification::insert($notifications); return $new; } }