client = $client; $this->company = $company; $this->event_vars = $event_vars; } public function broadcastWith() { $manager = new Manager(); $manager->setSerializer(new ArraySerializer()); $class = sprintf('App\\Transformers\\%sTransformer', class_basename($this->client)); $transformer = new $class(); $resource = new Item($this->client, $transformer, $this->client->getEntityType()); $data = $manager->createData($resource)->toArray(); return $data; } /** * Get the channels the event should broadcast on. * * @return Channel|array */ public function broadcastOn() { return [ new PrivateChannel("company-{$this->company->company_key}"), ]; } }