Completed
Push — dev ( 0a1751...897647 )
by Darko
07:52
created

AccountWillExpire   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A build() 0 3 1
1
<?php
2
3
namespace App\Mail;
4
5
use App\Models\Settings;
6
use Illuminate\Bus\Queueable;
7
use Illuminate\Mail\Mailable;
8
use Illuminate\Queue\SerializesModels;
9
10
class AccountWillExpire extends Mailable
11
{
12
    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: $id, $class, $relations
Loading history...
13
14
    private $days;
15
16
    private $user;
17
18
    /**
19
     * Create a new message instance.
20
     *
21
     * @return void
22
     */
23
    public function __construct($user, $days)
24
    {
25
        $this->user = $user;
26
        $this->days = $days;
27
    }
28
29
    /**
30
     * Build the message.
31
     *
32
     * @return $this
33
     */
34
    public function build()
35
    {
36
        return $this->from(Settings::settingValue('site.main.email'))->subject('Account about to expire')->view('emails.accountAboutToExpire')->with(['account' => $this->user->role->name, 'username' => $this->user->username, 'site' => Settings::settingValue('site.main.title'), 'days' => $this->days]);
37
    }
38
}
39