Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
VerifyEmail
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 3
20
0.00% covered (danger)
0.00%
0 / 1
 via
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 toMail
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
6
 verificationUrl
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Notifications\User;
4
5use Illuminate\Notifications\Messages\MailMessage;
6use Illuminate\Notifications\Notification;
7use Illuminate\Support\Carbon;
8use Illuminate\Support\Facades\Config;
9use Illuminate\Support\Facades\Lang;
10use Illuminate\Support\Facades\URL;
11
12class VerifyEmail extends Notification
13{
14    public function via($notifiable): array
15    {
16        return ['mail'];
17    }
18
19    public function toMail($notifiable): MailMessage
20    {
21        $verificationUrl = $this->verificationUrl($notifiable);
22
23        return (new MailMessage)
24            ->bcc(config('hubspotconfig.bcc_email'))
25            ->subject(Lang::get('Verify Email Address'))
26            ->view('mail.user.verify', [
27                'name' => $notifiable->first_name,
28                'verificationUrl' => $verificationUrl,
29                'verification_code' => (isset($notifiable->verification_code)) ? $notifiable->verification_code : '',
30
31            ]);
32
33        // return (new MailMessage)
34        // ->bcc(config('hubspotconfig.bcc_email'))
35        // ->subject(Lang::get('Verify Email Address'))
36        // ->line(Lang::get('Please click the button below to verify your email address.'))
37        // ->action(Lang::get('Verify Email Address'), $verificationUrl)
38        // ->line(Lang::get('If you did not create an account, no further action is required.'))
39        //->markdown('mail.email');
40    }
41
42    /**
43     * Generate a relative url link for verification
44     *
45     * @param  mixed  $notifiable
46     */
47    protected function verificationUrl($notifiable): string
48    {
49        return URL::temporarySignedRoute(
50            'user.verification.verify',
51            Carbon::now()->addDay(),
52            [
53                'id' => $notifiable->getKey(),
54                'hash' => sha1($notifiable->getEmailForVerification()),
55            ]
56        );
57    }
58}