2018-03-03 12:44:41 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications;
|
|
|
|
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
2019-03-13 20:12:03 -07:00
|
|
|
use Illuminate\Notifications\Notification;
|
2018-03-03 12:44:41 -08:00
|
|
|
|
|
|
|
class WelcomeNotification extends Notification
|
|
|
|
{
|
|
|
|
use Queueable;
|
|
|
|
|
2021-06-10 13:15:52 -07:00
|
|
|
private $_data = [];
|
2018-03-03 12:44:41 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new notification instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct(array $content)
|
|
|
|
{
|
2023-01-17 16:33:25 -08:00
|
|
|
$this->_data['email'] = htmlspecialchars_decode($content['email']);
|
|
|
|
$this->_data['first_name'] = htmlspecialchars_decode($content['first_name']);
|
|
|
|
$this->_data['last_name'] = htmlspecialchars_decode($content['last_name']);
|
|
|
|
$this->_data['username'] = htmlspecialchars_decode($content['username']);
|
|
|
|
$this->_data['password'] = htmlspecialchars_decode($content['password']);
|
2023-04-05 16:05:40 -07:00
|
|
|
$this->_data['url'] = config('app.url');
|
2018-03-03 12:44:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the notification's delivery channels.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2020-05-23 11:56:56 -07:00
|
|
|
public function via()
|
2018-03-03 12:44:41 -08:00
|
|
|
{
|
|
|
|
return ['mail'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mail representation of the notification.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
|
|
|
*/
|
2020-05-23 11:56:56 -07:00
|
|
|
public function toMail()
|
2018-03-03 12:44:41 -08:00
|
|
|
{
|
2023-02-06 12:41:54 -08:00
|
|
|
return (new MailMessage())
|
2021-06-10 13:15:52 -07:00
|
|
|
->subject(trans('mail.welcome', ['name' => $this->_data['first_name'].' '.$this->_data['last_name']]))
|
2018-03-03 12:44:41 -08:00
|
|
|
->markdown('notifications.Welcome', $this->_data);
|
|
|
|
}
|
|
|
|
}
|