Files
exchange/app/Notifications/BookingUpdated.php
T
Jack Goh d56f185c69 added vue time ago component
added custom field for booking updated notification
updated fetch notification on frontend
2018-08-30 16:04:14 +08:00

71 lines
1.5 KiB
PHP

<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Notifications\Messages\BroadcastMessage;
use App\Booking;
class BookingUpdated extends Notification
{
use Queueable;
protected $details;
protected $link;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($details, $link)
{
$this->details = $details;
$this->link = $link;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['database', 'broadcast'];
}
public function toDatabase($notifiable)
{
return [
'details' => $this->details,
'link' => $this->link
];
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
'details' => $this->details,
'link' => $this->link
];
}
public function toBroadcast($notifiable)
{
return new BroadcastMessage([
'details' => $this->details,
'link' => $this->link
]);
}
}