/ app / Events / UserAssignmentEvent.php
UserAssignmentEvent.php
 1  <?php
 2  
 3  namespace App\Events;
 4  
 5  use App\Models\Dossier;
 6  use App\Models\User;
 7  use Illuminate\Broadcasting\InteractsWithSockets;
 8  use Illuminate\Broadcasting\PrivateChannel;
 9  use Illuminate\Contracts\Queue\ShouldQueue;
10  use Illuminate\Foundation\Events\Dispatchable;
11  use Illuminate\Queue\SerializesModels;
12  
13  class UserAssignmentEvent implements ShouldQueue
14  {
15      use Dispatchable, InteractsWithSockets, SerializesModels;
16  
17  
18  
19      /**
20       * Create a new event instance.
21       *
22       * @return void
23       */
24      public function __construct(
25          public User $user,
26          public Dossier $dossier,
27          public bool $isAssigned
28      ) {
29      }
30  
31      /**
32       * Get the channels the event should broadcast on.
33       *
34       * @return \Illuminate\Broadcasting\Channel|array
35       */
36      public function broadcastOn()
37      {
38          return new PrivateChannel('channel-name');
39      }
40  }