47 lines
966 B
PHP
47 lines
966 B
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class CommentNotification extends Notification
|
|
{
|
|
use Queueable;
|
|
|
|
protected $type;
|
|
protected $message;
|
|
protected $url;
|
|
|
|
/**
|
|
* Create a new notification instance.
|
|
*/
|
|
public function __construct($type, $message, $url)
|
|
{
|
|
$this->type = $type;
|
|
$this->message = $message;
|
|
$this->url = $url;
|
|
}
|
|
|
|
/**
|
|
* Get the notification's delivery channels.
|
|
*
|
|
* @return array<int, string>
|
|
*/
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['database'];
|
|
}
|
|
|
|
public function toDatabase($notifiable)
|
|
{
|
|
return [
|
|
'type' => $this->type,
|
|
'message' => $this->message,
|
|
'url' => $this->url,
|
|
];
|
|
}
|
|
}
|