58 lines
1,022 B
PHP
58 lines
1,022 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Notifications;
|
||
|
|
||
|
use Illuminate\Bus\Queueable;
|
||
|
use Illuminate\Notifications\Notification;
|
||
|
|
||
|
class DynamicNotification extends Notification
|
||
|
|
||
|
{
|
||
|
use Queueable;
|
||
|
/**
|
||
|
* @var string
|
||
|
*/
|
||
|
private $title;
|
||
|
/**
|
||
|
* @var string
|
||
|
*/
|
||
|
private $content;
|
||
|
|
||
|
/**
|
||
|
* Create a new notification instance.
|
||
|
*
|
||
|
* @param string $title
|
||
|
* @param string $content
|
||
|
*/
|
||
|
public function __construct($title, $content)
|
||
|
{
|
||
|
$this->title = $title;
|
||
|
$this->content = $content;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Get the notification's delivery channels.
|
||
|
*
|
||
|
* @param mixed $notifiable
|
||
|
* @return array
|
||
|
*/
|
||
|
public function via()
|
||
|
{
|
||
|
return ['database'];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Get the array representation of the notification.
|
||
|
*
|
||
|
* @param mixed $notifiable
|
||
|
* @return array
|
||
|
*/
|
||
|
public function toArray()
|
||
|
{
|
||
|
return [
|
||
|
'title' => $this->title,
|
||
|
'content' => $this->content,
|
||
|
];
|
||
|
}
|
||
|
}
|