Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| ResetPassword | |
0.00% |
0 / 13 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| via | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| toMail | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Notifications\User; |
| 4 | |
| 5 | use Illuminate\Notifications\Messages\MailMessage; |
| 6 | use Illuminate\Notifications\Notification; |
| 7 | use Illuminate\Support\Facades\Lang; |
| 8 | |
| 9 | class ResetPassword extends Notification |
| 10 | { |
| 11 | /** |
| 12 | * The password reset token. |
| 13 | * |
| 14 | * @var string |
| 15 | */ |
| 16 | public $token; |
| 17 | public string $frontendBaseUrl; |
| 18 | |
| 19 | /** |
| 20 | * Create a notification instance. |
| 21 | * |
| 22 | * @return void |
| 23 | */ |
| 24 | public function __construct(string $token) |
| 25 | { |
| 26 | $this->token = $token; |
| 27 | $this->frontendBaseUrl = config('romeo.frontend-base-url'); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Get the notification's channels. |
| 32 | * |
| 33 | * @param mixed $notifiable |
| 34 | * @return array|string |
| 35 | */ |
| 36 | public function via($notifiable): array |
| 37 | { |
| 38 | return ['mail']; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Build the mail representation of the notification. |
| 43 | * |
| 44 | * @param mixed $notifiable |
| 45 | */ |
| 46 | public function toMail($notifiable): MailMessage |
| 47 | { |
| 48 | $url = $this->frontendBaseUrl . '/session/change-password' . '?' . |
| 49 | 'email=' . $notifiable->getEmailForPasswordReset() . '&' . |
| 50 | 'token=' . $this->token; |
| 51 | |
| 52 | return (new MailMessage) |
| 53 | ->bcc(config('hubspotconfig.bcc_email')) |
| 54 | ->subject(Lang::get('Out with the old and in with the new')) |
| 55 | ->view('mail.user.reset', [ |
| 56 | 'name' => $notifiable->first_name, |
| 57 | 'url' => $url, |
| 58 | ]); |
| 59 | } |
| 60 | } |