/ app / Notifications / FileUploaded.php
FileUploaded.php
 1  <?php
 2  
 3  namespace App\Notifications;
 4  
 5  use App\Models\Dossier;
 6  use Illuminate\Bus\Queueable;
 7  use Illuminate\Notifications\Notification;
 8  
 9  class FileUploaded extends Notification
10  {
11      use Queueable;
12  
13      /**
14       * Create a new notification instance.
15       *
16       * @return void
17       */
18      public function __construct(private Dossier $dossier, private string $path)
19      {
20          //
21      }
22  
23      /**
24       * Get the notification's delivery channels.
25       *
26       * @param  mixed  $notifiable
27       * @return array
28       */
29      public function via($notifiable)
30      {
31          return ['database'];
32      }
33  
34      /**
35       * Get the array representation of the notification.
36       *
37       * @param  mixed  $notifiable
38       * @return array
39       */
40      public function toArray($notifiable)
41      {
42          return [
43              'user_id' => $notifiable->id,
44              'title' => __('notifications.message-title.FileUploaded', [
45                  'dossierCode' => $this->dossier->code,
46              ]),
47              'message' => __('notifications.messages.FileUploaded', [
48                  'dossierCode' => $this->dossier->code,
49                  'path' => $this->path,
50              ]),
51              'dossier_id' => $this->dossier->id,
52          ];
53      }
54  }