diff --git a/app/Events/ServiceStatusChanged.php b/app/Events/ServiceStatusChanged.php index 506f77881..97ca4b0f8 100644 --- a/app/Events/ServiceStatusChanged.php +++ b/app/Events/ServiceStatusChanged.php @@ -7,19 +7,18 @@ use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; +use Illuminate\Support\Facades\Auth; class ServiceStatusChanged implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; - public ?int $teamId = null; - - public function __construct($teamId = null) - { - if (is_null($teamId) && auth()->check() && auth()->user()->currentTeam()) { - $teamId = auth()->user()->currentTeam()->id; + public function __construct( + public ?int $teamId = null + ) { + if (is_null($this->teamId) && Auth::check() && Auth::user()->currentTeam()) { + $this->teamId = Auth::user()->currentTeam()->id; } - $this->teamId = $teamId; } public function broadcastOn(): array