title: laravel:send notification with (data) when update a record
body: <p>Problem: how can I display data with update function?</p>
  
  <p>the notification is sent but witout data that I specified in  this function :
      public function toDatabase($notifiable)
      {
          return [
              'data'=>$this->booking->num_ch
             ];<br>
      }</p>
  
  <p>it works with store function  but it dosn't with update function</p>
  
  <p>my notification class:</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\Booking;
  
  class NewMessage extends Notification
  {
      use Queueable;
      public $booking;
  
      public function __construct(Booking $booking)
      {
          //
          $this-&gt;booking = $booking;
  
      }
  
  
      public function via($notifiable)
      {
          return ['database'];
      }
  
  
      public function toDatabase($notifiable)
      {
          return [
              'data'=&gt;$this-&gt;booking-&gt;num_ch
             ];                  
      }
  
  
  
  </code></pre>
  
  <p>my update function :</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use App\Booking;
  use App\User;
  use Notification;
  use App\Notifications\NewMessage;
  
  class DispoController extends Controller
  {
  
  
      public function update(Request $request,$id,Booking $booking)
      {
          //  
           Booking::findOrFail($id)-&gt;update([
           'num_ch'=&gt;$request-&gt;num_ch,
           'type'=&gt;$request-&gt;type,
           'statut'=&gt;$request-&gt;statut,
           'enfants'=&gt;$request-&gt;enfants,
           'adultes'=&gt;$request-&gt;adultes,
  
  
          ]);
  
          auth()-&gt;user()-&gt;notify(new NewMessage($booking)); // notification
  
  
        return redirect()-&gt;route('booking.index')-&gt;with(['success'=&gt;'succés']);
  
      }
  
  
  </code></pre>
  
  <p>it shows just "new booking"</p>
  
  <pre><code> @foreach(Auth::user()-&gt;unreadNotifications as $not)
           &lt;li&gt;
            &lt;a class="dropdown-item"  &gt;new booking {{$not-&gt;data['data']}}&lt;/a&gt;
           &lt;/li&gt;
   @endforeach
  
  </code></pre>