Files
core/app/Notifications/ResetPasswordNotification.php
T

53 lines
1.3 KiB
PHP

<?php
namespace App\Notifications;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class ResetPasswordNotification extends Notification
{
/**
* @var string
*/
private $token;
/**
* Create a new notification instance.
* @return void
*/
public function __construct($token)
{
$this->token = $token;
}
/**
* 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)
{
$url = route('password.reset', ['token' => $this->token, 'email' => $notifiable->email]);
return (new MailMessage())->subject(trans('notification.forgottenPassword.subject'))
->line(trans('notification.forgottenPassword.firstLine'))
->action(trans('notification.forgottenPassword.button'), $url)
->line(trans('notification.forgottenPassword.lastLine'));
}
}