ldc-legaulois/app/Notifications/Customer/ResetPassword.php

54 lines
1.8 KiB
PHP
Raw Normal View History

2024-07-05 16:34:57 +02:00
<?php
namespace App\Notifications\Customer;
use Illuminate\Auth\Notifications\ResetPassword as NotificationsResetPassword;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\URL;
class ResetPassword extends NotificationsResetPassword
{
/**
* Reset password.
2024-07-05 16:34:57 +02:00
*
* @param string $token
* @return void
*/
public function __construct(string $token)
{
parent::__construct($token);
static::$createUrlCallback = function ($notifiable, $token) {
return \url(URL::temporarySignedRoute(
'club.password.reset',
now()->addHours(24),
[
'token' => $token,
'email' => $notifiable->getEmailForPasswordReset(),
],
true
));
};
}
/**
* Build the mail representation of the notification.
*
2024-07-30 16:05:27 +02:00
* @param mixed $notifiable
2024-07-05 16:34:57 +02:00
* @return \Illuminate\Notifications\Messages\MailMessage
*/
2024-07-30 16:05:27 +02:00
public function toMail(mixed $notifiable): \Illuminate\Notifications\Messages\MailMessage
2024-07-05 16:34:57 +02:00
{
return (new MailMessage())
2024-07-19 12:05:37 +02:00
->template('notifications::email-club')
2024-07-05 16:34:57 +02:00
->subject(trans('Mot de passe oublié - :site_name', ['site_name' => config('app.name')]))
/** @var string $firstname */
->greeting(trans('Bonjour :name', ['name' => $notifiable->api_data->firstname]))
2024-07-05 16:34:57 +02:00
->line(trans(
"Afin réinitialiser votre mot de passe pour vous connecter à :site_name, cliquez sur le lien suivant :",
['site_name' => config('app.name')]
))
/** @var string $verificationUrl */
->action(trans('Réinitialisez votre mot de passe'), $this->resetUrl($notifiable));
2024-07-05 16:34:57 +02:00
}
}