AccountWillExpire   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 37
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A build() 0 3 1
1
<?php
2
3
namespace App\Mail;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Mail\Mailable;
7
use Illuminate\Queue\SerializesModels;
8
9
class AccountWillExpire extends Mailable
10
{
11
    use Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Mail\AccountWillExpire: $collectionClass, $id, $relations, $class, $keyBy
Loading history...
12
13
    private $days;
14
15
    private $user;
16
17
    /**
18
     * @var mixed
19
     */
20
    private $siteEmail;
21
22
    /**
23
     * @var mixed
24
     */
25
    private $siteTitle;
26
27
    /**
28
     * Create a new message instance.
29
     *
30
     * @return void
31
     */
32
    public function __construct($user, $days)
33
    {
34
        $this->user = $user;
35
        $this->days = $days;
36
        $this->siteEmail = config('mail.from.address');
37
        $this->siteTitle = config('app.name');
38
    }
39
40
    /**
41
     * Build the message.
42
     */
43
    public function build(): static
44
    {
45
        return $this->from($this->siteEmail)->subject('Account about to expire')->view('emails.accountAboutToExpire')->with(['account' => $this->user->role->name, 'username' => $this->user->username, 'site' => $this->siteTitle, 'days' => $this->days]);
46
    }
47
}
48