['web', 'auth:admin'], ]); Broadcast::channel('ticket.{ticketId}', function ($user, $ticketId) { try { // Very explicit logging to see what arrives here Log::info("CHANNEL AUTH CHECK (ENTER)", [ 'user_present' => $user !== null, 'user_type' => is_object($user) ? get_class($user) : gettype($user), 'user_id' => $user->id ?? null, 'ticketId' => $ticketId, ]); // Find ticket and log $ticket = SupportTicket::find($ticketId); Log::info("CHANNEL AUTH: found ticket", [ 'ticket_exists' => $ticket ? true : false, 'ticket_id' => $ticket?->id, 'ticket_user_id' => $ticket?->user_id, ]); if (! $ticket) { Log::warning("CHANNEL AUTH: ticket not found", ['ticketId' => $ticketId]); return false; } // If admin, allow if ($user instanceof Admin) { Log::info("CHANNEL AUTH: admin allowed", ['admin_id' => $user->id]); return true; } // If normal user, check ownership if (is_object($user) && isset($user->id)) { $allowed = $ticket->user_id === $user->id; Log::info("CHANNEL AUTH: user allowed check", [ 'ticket_user_id' => $ticket->user_id, 'current_user_id' => $user->id, 'allowed' => $allowed ]); return $allowed; } Log::warning("CHANNEL AUTH: default deny"); return false; } catch (\Throwable $e) { Log::error("CHANNEL AUTH ERROR", [ 'message' => $e->getMessage(), 'trace' => $e->getTraceAsString() ]); return false; } }); Broadcast::channel('admin.chat', function ($admin) { return auth('admin')->check(); }); // Broadcast::channel('ticket.{ticketId}', function ($admin, $ticketId) { // \Log::info('CHANNEL AUTH OK', [ // 'admin_id' => $admin->id, // 'ticketId' => $ticketId, // ]); // return true; // });