title: Laravel Notification with Mailable
body: <p>In my Laravel application I have a <code>Notification</code> that sends a <code>Mailable</code> when a <code>User</code> is deleted. </p>
  
  <p><strong>The <code>Notification</code> class:</strong></p>
  
  <pre><code>&lt;?php
  
  namespace App\Notifications;
  
  use Illuminate\Bus\Queueable;
  use Illuminate\Notifications\Notification;
  use Illuminate\Contracts\Queue\ShouldQueue;
  use Illuminate\Notifications\Messages\MailMessage;
  use App\User;
  use App\Mail\UserDeleted as UserDeletedEmail;
  
  class UserDeleted extends Notification implements ShouldQueue
  {
      use Queueable;
  
      /**
       * The user instance being passed to the notification
       *
       * @var User $user
       */
      protected $user;
  
      /**
       * Create a new notification instance.
       *
       * @return void
       */
      public function __construct(User $user)
      {
          $this-&gt;user = $user;
      }
  
      /**
       * Get the notification's delivery channels.
       *
       * @param  mixed  $notifiable
       * @return array
       */
      public function via($notifiable)
      {
          return ['mail', 'database'];
      }
  
      /**
       * Get the mail representation of the notification.
       *
       * @param  mixed  $notifiable
       * @return \Illuminate\Notifications\Messages\MailMessage
       */
      public function toMail($notifiable)
      {
          return (new UserDeletedEmail($notifiable, $this-&gt;user));
      }
  
      /**
       * Get the array representation of the notification.
       *
       * @param  mixed  $notifiable
       * @return array
       */
      public function toArray($notifiable)
      {
          return [
              'user_id' =&gt; $this-&gt;user['id'],
              'user_username' =&gt; $this-&gt;user['username'],
              'user_email' =&gt; $this-&gt;user['email'],
              'user_full_name' =&gt; $this-&gt;user['full_name'],
  
          ];
      }
  }
  </code></pre>
  
  <p>In this case <code>$notifiable</code> is an instance of <code>User</code> but soo is <code>$user</code> as this is the user that has been deleted.</p>
  
  <p><strong>The <code>Mailable</code> looks like this:</strong></p>
  
  <pre><code>&lt;?php
  
  namespace App\Mail;
  
  use Illuminate\Bus\Queueable;
  use Illuminate\Mail\Mailable;
  use Illuminate\Queue\SerializesModels;
  use Spatie\Permission\Models\Role;
  use Illuminate\Contracts\Queue\ShouldQueue;
  use App\User;
  
  
  class UserDeleted extends Mailable
  {
      use Queueable, SerializesModels;
  
      /**
       * The order instance.
       *
       * @var User
       */
      public $user;
  
      /** 
       * Create a new message instance.
       *
       * @return void
       */
      public function __construct(User $user)
      {
          $this-&gt;user = $user;
      }
  
      /**
       * Build the message.
       *
       * @return $this
       */
      public function build()
      {
          return $this
              -&gt;to($this-&gt;user-&gt;email)
              -&gt;subject("{$this-&gt;user-&gt;full_name} been deleted from the Citibase Intranet")
              -&gt;markdown('mail.user-deleted');
      }
  }
  </code></pre>
  
  <p>The issue is, as they're both instances of <code>User</code> I'm effectively passing the wrong instance in the subject line.</p>
  
  <p>Everything is triggered through the <code>UserObserver</code>.</p>
  
  <pre><code>/**
   * Handle the user "deleted" event.
   *
   * @param  \App\User $user
   * @return void
   */
  public function deleted(User $user)
  {
      Log::notice("A user has been deleted: {$user-&gt;full_name} by " . optional(auth()-&gt;user())-&gt;full_name ?? "System");
  
      User::role(['admin'])-&gt;get()
          -&gt;each-&gt;notify(
              (new UserDeleted($user))-&gt;delay(now()-&gt;addSeconds(10))
          );
  }
  </code></pre>