mardi 1 janvier 2019

How can I create two different notifications for laravel? (like orderquote and booking)

I am trying to create two notifications using Laravel. First when the client fills out the orderquote form, the admin user at the backend gets the notification on their dashboard showing a notification of a new quote received, and if the client proceed further towards this booking and confirm it, the admin user again gets the notifications of a new bookings. But I want this booking to show separately. I have New quote icon and i also have new booking icon separate. so I want it show the notifications accordingly. So far, I can only do it one notification. I want something similar to this website if we see on top right corner on the navigation bar. We all have separate notifications for various things. How can I do that?

Code for the Quote Notifications:

App/Http/Controller/newQuoteController.php

$user = user::all();
\Notification::send($user,new NotifyUser($newquote));

then in my App/notifications/NotifyUser.php

public $newquote;

public function __construct(NewQuote $newquote)
{
    $this->newquote=$newquote;
}

public function via($notifiable)
{
    return ['database'];
}

public function toDatabase($notifiable)
{
    return [
       'data' => $this->newquote->id,
    ];
}

Now for the booking:

App/Http/Controller/confirmedBookingController.php

  $user = user::all();
  \Notification::send($user,new BookingNotification($bookings));

then in my App/notifications/BookingNotification.php

public $bookings;

public function __construct(Bookings $bookings)
{
    $this->bookings=$bookings;
}

public function via($notifiable)
{
    return ['database'];
}

public function toDatabase($notifiable)
{
  return [

     'data' => $this->bookings->id,
  ];
}



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2AoPqvI
via IFTTT

Aucun commentaire:

Enregistrer un commentaire