70208d2157
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions. You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root. For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
67 lines
1.1 KiB
PHP
67 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class DynamicNotification extends Notification
|
|
{
|
|
use Queueable;
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
private $via;
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
private $database;
|
|
|
|
/**
|
|
* @var MailMessage
|
|
*/
|
|
private $mail;
|
|
|
|
/**
|
|
* Create a new notification instance.
|
|
*
|
|
* @param array $via
|
|
* @param array $database
|
|
* @param MailMessage $mail
|
|
*/
|
|
public function __construct($via, $database, $mail)
|
|
{
|
|
$this->via = $via;
|
|
$this->database = $database;
|
|
$this->mail = $mail;
|
|
}
|
|
|
|
/**
|
|
* Get the notification's delivery channels.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return array
|
|
*/
|
|
public function via()
|
|
{
|
|
return $this->via;
|
|
}
|
|
|
|
public function toMail()
|
|
{
|
|
return $this->mail;
|
|
}
|
|
|
|
/**
|
|
* Get the array representation of the notification.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return array
|
|
*/
|
|
public function toArray()
|
|
{
|
|
return $this->database;
|
|
}
|
|
}
|