model = $model; $this->action = $action; $this->paramIds = collect($params); $this->paramIds->shift(); $this->eventsRegister(); } protected function eventsRegister() { if($this->action == 'attach'){ if(!$this->paramIds->count()){ return; } event(new UsersReceivedDocument($this->model, User::find($this->paramIds))); } } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new PrivateChannel('channel-name'); } }