VerifyEmail   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 15 1
A __construct() 0 4 1
1
<?php
2
3
4
namespace App\Mail\Auth;
5
6
7
use Illuminate\Bus\Queueable;
8
use Illuminate\Mail\Mailable;
9
use Illuminate\Queue\SerializesModels;
10
use Illuminate\Support\Carbon;
11
use Illuminate\Support\Facades\Config;
12
use Illuminate\Support\Facades\URL;
13
14
class VerifyEmail extends Mailable
15
{
16
    use Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Mail\Auth\VerifyEmail: $id, $relations, $class, $keyBy
Loading history...
17
18
    private $user;
19
    private $callback;
20
21
    public function __construct($user, string $callback = null)
22
    {
23
        $this->user = $user;
24
        $this->callback = $callback;
25
    }
26
27
    public function build()
28
    {
29
        $url = URL::temporarySignedRoute(
30
            'verification.verify',
31
            Carbon::now()->addMinutes(config('auth.verification.expire')),
32
            [
33
                'id' => $this->user->getKey(),
34
                'hash' => sha1($this->user->getEmailForVerification()),
35
                'callback' => $this->callback
36
            ]
37
        );
38
39
        return $this->view('mails.auth.verify-email', [
40
            'url' => $url,
41
        ])->subject('Tripleperformance : Vérifiez votre email');
42
    }
43
}
44