2021-07-26 02:24:55 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications;
|
|
|
|
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
|
|
|
|
class DynamicNotification extends Notification
|
|
|
|
{
|
|
|
|
use Queueable;
|
2023-01-05 17:01:42 +00:00
|
|
|
|
2021-07-26 02:24:55 +00:00
|
|
|
/**
|
2021-08-02 22:10:59 +00:00
|
|
|
* @var array
|
2021-07-26 02:24:55 +00:00
|
|
|
*/
|
2021-08-02 22:10:59 +00:00
|
|
|
private $via;
|
2023-01-05 17:01:42 +00:00
|
|
|
|
2021-07-26 02:24:55 +00:00
|
|
|
/**
|
2021-08-02 22:10:59 +00:00
|
|
|
* @var array
|
2021-07-26 02:24:55 +00:00
|
|
|
*/
|
2021-08-02 22:10:59 +00:00
|
|
|
private $database;
|
2023-01-05 17:01:42 +00:00
|
|
|
|
2021-08-02 22:10:59 +00:00
|
|
|
/**
|
|
|
|
* @var MailMessage
|
|
|
|
*/
|
|
|
|
private $mail;
|
2023-01-05 17:01:42 +00:00
|
|
|
|
2021-07-26 02:24:55 +00:00
|
|
|
/**
|
|
|
|
* Create a new notification instance.
|
|
|
|
*
|
2023-01-05 17:01:42 +00:00
|
|
|
* @param array $via
|
|
|
|
* @param array $database
|
|
|
|
* @param MailMessage $mail
|
2021-07-26 02:24:55 +00:00
|
|
|
*/
|
2021-08-02 22:10:59 +00:00
|
|
|
public function __construct($via, $database, $mail)
|
2021-07-26 02:24:55 +00:00
|
|
|
{
|
2021-08-02 22:10:59 +00:00
|
|
|
$this->via = $via;
|
|
|
|
$this->database = $database;
|
|
|
|
$this->mail = $mail;
|
2021-07-26 02:24:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the notification's delivery channels.
|
|
|
|
*
|
2023-01-05 17:01:42 +00:00
|
|
|
* @param mixed $notifiable
|
2021-07-26 02:24:55 +00:00
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function via()
|
|
|
|
{
|
2021-08-02 22:10:59 +00:00
|
|
|
return $this->via;
|
2021-07-26 02:24:55 +00:00
|
|
|
}
|
|
|
|
|
2021-08-02 22:10:59 +00:00
|
|
|
public function toMail()
|
|
|
|
{
|
|
|
|
return $this->mail;
|
|
|
|
}
|
2023-01-05 17:01:42 +00:00
|
|
|
|
2021-07-26 02:24:55 +00:00
|
|
|
/**
|
|
|
|
* Get the array representation of the notification.
|
|
|
|
*
|
2023-01-05 17:01:42 +00:00
|
|
|
* @param mixed $notifiable
|
2021-07-26 02:24:55 +00:00
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function toArray()
|
|
|
|
{
|
2021-08-02 22:10:59 +00:00
|
|
|
return $this->database;
|
2021-07-26 02:24:55 +00:00
|
|
|
}
|
|
|
|
}
|