ldc-legaulois/app/Notifications/Customer/ResetPassword.php
2026-07-30 13:10:06 +02:00

56 lines
1.9 KiB
PHP

<?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.
*
* @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.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail(mixed $notifiable): \Illuminate\Notifications\Messages\MailMessage
{
return (new MailMessage())
->template('notifications::email-club')
->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]))
->line(trans(
"Afin réinitialiser votre mot de passe pour vous connecter :strong sur le Club des Gaulois, :endStrong cliquez sur le lien ci-dessous (lien valable 24h uniquement) :",
[
'strong' => '<strong>',
'endStrong' => '</strong>'
]
))
/** @var string $verificationUrl */
->action(trans('Réinitialisez votre mot de passe'), $this->resetUrl($notifiable));
}
}