SendInvite::build()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Mail;
4
5
use App\Models\User;
6
use Illuminate\Bus\Queueable;
7
use Illuminate\Mail\Mailable;
8
use Illuminate\Queue\SerializesModels;
9
10
class SendInvite 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\SendInvite: $collectionClass, $id, $relations, $class, $keyBy
Loading history...
13
14
    /**
15
     * @var User
16
     */
17
    public $user;
18
19
    /**
20
     * @var string
21
     */
22
    public $invite;
23
24
    /**
25
     * @var mixed
26
     */
27
    private $siteEmail;
28
29
    /**
30
     * @var mixed
31
     */
32
    private $siteTitle;
33
34
    /**
35
     * SendInvite constructor.
36
     */
37
    public function __construct(User $user, $invite)
38
    {
39
        $this->user = $user;
40
        $this->invite = $invite;
41
        $this->siteEmail = config('mail.from.address');
42
        $this->siteTitle = config('app.name');
43
    }
44
45
    /**
46
     * Build the message.
47
     *
48
     *
49
     * @throws \Exception
50
     */
51
    public function build(): static
52
    {
53
        return $this->from($this->siteEmail)->subject('Invite received')->view('emails.sendinvite')->with(['invite' => $this->invite, 'username' => $this->user['username'], 'site' => $this->siteTitle, 'email' => $this->user['email']]);
54
    }
55
}
56