2024-07-05 16:34:57 +02:00
< ? php
namespace App\Notifications\Customer ;
use Illuminate\Auth\Notifications\ResetPassword as NotificationsResetPassword ;
2026-10-19 15:09:39 +02:00
use Illuminate\Bus\Queueable ;
use Illuminate\Contracts\Queue\ShouldQueue ;
2024-07-05 16:34:57 +02:00
use Illuminate\Notifications\Messages\MailMessage ;
use Illuminate\Support\Facades\URL ;
2026-09-28 14:16:32 +02:00
use Symfony\Component\Mime\Email ;
2024-07-05 16:34:57 +02:00
2026-10-19 15:09:39 +02:00
class ResetPassword extends NotificationsResetPassword implements ShouldQueue
2024-07-05 16:34:57 +02:00
{
2026-10-19 15:09:39 +02:00
use Queueable ;
public $tries = 3 ;
2026-10-19 11:16:32 +02:00
/**
* The customer firstname .
*
* @ var string
*/
protected $firstname ;
2024-07-05 16:34:57 +02:00
/**
2024-10-04 17:03:04 +02:00
* Reset password .
2024-07-05 16:34:57 +02:00
*
* @ return void
*/
2026-10-19 11:16:32 +02:00
public function __construct ( string $token , string $firstname )
2024-07-05 16:34:57 +02:00
{
2026-10-19 11:16:32 +02:00
$this -> firstname = $firstname ;
2024-07-05 16:34:57 +02:00
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 .
*/
2026-09-25 16:25:31 +02:00
public function toMail ( mixed $notifiable ) : MailMessage
2024-07-05 16:34:57 +02:00
{
return ( new MailMessage ())
2026-09-28 14:16:32 +02:00
-> view ([
'html' => 'notifications::email-club' ,
'text' => 'notifications::email-club-text' ,
])
2024-07-05 16:34:57 +02:00
-> subject ( trans ( 'Mot de passe oublié - :site_name' , [ 'site_name' => config ( 'app.name' )]))
/** @var string $firstname */
2026-10-19 11:16:32 +02:00
-> greeting ( trans ( 'Bonjour :name,' , [ 'name' => $this -> firstname ]))
2024-07-05 16:34:57 +02:00
-> line ( trans (
2026-10-20 10:50:47 +02:00
'Afin de 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) :' ,
2026-07-30 13:10:06 +02:00
[
2026-09-25 16:25:31 +02:00
'strong' => '<strong>' ,
'endStrong' => '</strong>' ,
2026-07-30 13:10:06 +02:00
]
2024-07-05 16:34:57 +02:00
))
/** @var string $verificationUrl */
2026-09-28 14:16:32 +02:00
-> action ( trans ( 'Réinitialisez votre mot de passe' ), $this -> resetUrl ( $notifiable ))
-> withSymfonyMessage ( function ( Email $message ) {
$message -> html ( $message -> getHtmlBody (), 'utf-8' );
});
2024-07-05 16:34:57 +02:00
}
}