You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

78 lines
1.8 KiB

<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class MailNotification extends Notification implements ShouldQueue
{
use Queueable;
public $message;
/**
* The name of the queue connection to use when queueing the notification.
*
* @var string
*/
// public $connection = 'redis';
/**
* If your queue connection's after_commit configuration option is set to true,
* indicate that a particular queued listener should be dispatched after all database transactions closed
*
* @var boolean
*/
// public $afterCommit = true;
/**
* Determine which queues should be used for notification.
*
* @return string
*/
// public $queue = 'mail-queue';
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($message)
{
$this->connection = 'redis';
$this->queue = 'mail-queue';
$this->afterCommit = true;
$this->message = $message;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->greeting($this->message['greeting'])
->line($this->message['body'])
->subject($this->message['subject'])
->action('بیشتر', $this->message['link'] ?? url('/'));
}
}