ldc-tregalette/app/Notifications/Customer/VerifyEmail.php

67 lines
2.2 KiB
PHP
Raw Permalink Normal View History

2023-12-15 15:53:55 +00:00
<?php
namespace App\Notifications\Customer;
use Illuminate\Auth\Notifications\VerifyEmail as NotificationsVerifyEmail;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\URL;
class VerifyEmail extends NotificationsVerifyEmail
{
/**
* The callback that should be used to create the reset password URL.
*
* @var \Closure|null
*/
public static $createUrlCallback;
/**
* VerifyEmail
*
* @return void
*/
public function __construct()
{
static::$createUrlCallback = function ($notifiable) {
return \url(URL::temporarySignedRoute(
'fo.verification.verify',
Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
[
2024-01-26 16:24:14 +01:00
'id' => $notifiable->getKey(),
2023-12-15 15:53:55 +00:00
'hash' => sha1($notifiable->getEmailForVerification()),
],
true
));
};
}
/**
* Build the mail representation of the notification.
*
2024-01-26 16:24:14 +01:00
* @param mixed $notifiable
2023-12-15 15:53:55 +00:00
* @return \Illuminate\Notifications\Messages\MailMessage
* @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing
*/
2024-01-26 16:24:14 +01:00
public function toMail($notifiable): \Illuminate\Notifications\Messages\MailMessage
2023-12-15 15:53:55 +00:00
{
// phpcs:enable
2024-01-26 16:24:14 +01:00
/** @var \App\Models\Customer $notifiable */
2023-12-15 15:53:55 +00:00
$verificationUrl = $this->verificationUrl($notifiable);
$firstname = $notifiable->api_data->firstname;
return (new MailMessage())
->subject(trans("Inscription - :site_name", ['site_name' => config('app.name')]))
/** @var string $firstname */
->greeting("Bonjour " . $firstname)
->line(trans(
"Vous venez de créer un compte sur :site_name.",
['site_name' => config('app.name')]
))
->line("Pour confirmer votre inscription, merci de cliquer sur le lien ci-dessous :")
/** @var string $verificationUrl */
->action(trans('Confirmer mon adresse email'), $verificationUrl);
}
}