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