2024-07-05 16:34:57 +02:00
< ? php
namespace App\Notifications\Customer ;
use Illuminate\Auth\Notifications\VerifyEmail as NotificationsVerifyEmail ;
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\Carbon ;
use Illuminate\Support\Facades\Config ;
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 VerifyEmail extends NotificationsVerifyEmail 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
* Verify email .
2024-07-05 16:34:57 +02:00
*
* @ return void
*/
2026-10-19 11:16:32 +02:00
public function __construct ( 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
static :: $createUrlCallback = function ( $notifiable ) {
return \url ( URL :: temporarySignedRoute (
'club.verification.verify' ,
Carbon :: now () -> addMinutes ( Config :: get ( 'auth.verification.expire' , 60 )),
[
2024-07-30 16:05:27 +02:00
'id' => $notifiable -> getKey (),
2024-07-05 16:34:57 +02:00
'hash' => sha1 ( $notifiable -> getEmailForVerification ()),
],
true
));
};
}
/**
* Build the mail representation of the notification .
*
* @ phpcs : disable Squiz . Commenting . FunctionComment . TypeHintMissing
*/
2026-09-25 16:25:31 +02:00
public function toMail ( mixed $notifiable ) : MailMessage
2024-07-05 16:34:57 +02:00
{
// phpcs:enable
2024-07-30 16:05:27 +02:00
/** @var string $verificationUrl */
2024-07-05 16:34:57 +02:00
$verificationUrl = $this -> verificationUrl ( $notifiable );
return ( new MailMessage ())
2026-09-28 14:16:32 +02:00
-> view ([
'html' => 'notifications::email-club' ,
'text' => 'notifications::email-club-text' ,
])
2026-10-19 10:06:09 +02:00
-> subject ( trans ( 'Validation de votre compte - :site_name' , [ 'site_name' => config ( 'app.name' )]))
2026-10-19 11:16:32 +02:00
-> greeting ( trans ( 'Bonjour :name,' , [ 'name' => $this -> firstname ]))
2026-09-28 14:16:32 +02:00
-> line ( trans (
" Vous venez de créer un compte :strong sur le Club des Gaulois : :endStrong quelle bonne idée pour bénéficier de la Bourse aux échanges Départ'aimants et profitez des bons de réduction à imprimer ! " ,
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
]
))
2026-09-25 16:25:31 +02:00
-> line ( 'Vous pouvez également enregistrer vos recettes favorites et les commenter et faire une liste de courses avec vos produits Le Gaulois préféré.' )
2026-10-19 10:06:09 +02:00
-> line ( 'Pour confirmer votre inscription, merci de cliquer sur le lien ci-dessous (lien valable 1h uniquement) :' )
2026-09-28 14:16:32 +02:00
-> action ( trans ( 'Confirmer mon adresse mail' ), $verificationUrl )
-> withSymfonyMessage ( function ( Email $message ) {
$message -> html ( $message -> getHtmlBody (), 'utf-8' );
});
2024-07-05 16:34:57 +02:00
}
}