Passed
Push — master ( 5aa5e3...07d8b3 )
by Darko
09:19
created

InvitationMail   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A content() 0 10 1
A attachments() 0 3 1
A envelope() 0 4 1
A __construct() 0 3 1
1
<?php
2
3
namespace App\Mail;
4
5
use App\Models\Invitation;
6
use Illuminate\Bus\Queueable;
7
use Illuminate\Mail\Mailable;
8
use Illuminate\Mail\Mailables\Content;
9
use Illuminate\Mail\Mailables\Envelope;
10
use Illuminate\Queue\SerializesModels;
11
12
class InvitationMail extends Mailable
13
{
14
    use Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Mail\InvitationMail: $collectionClass, $id, $relations, $class, $keyBy
Loading history...
15
16
    public Invitation $invitation;
17
18
    /**
19
     * Create a new message instance.
20
     */
21
    public function __construct(Invitation $invitation)
22
    {
23
        $this->invitation = $invitation;
24
    }
25
26
    /**
27
     * Get the message envelope.
28
     */
29
    public function envelope(): Envelope
30
    {
31
        return new Envelope(
32
            subject: 'You\'re invited to join '.config('app.name'),
33
        );
34
    }
35
36
    /**
37
     * Get the message content definition.
38
     */
39
    public function content(): Content
40
    {
41
        return new Content(
42
            view: 'emails.invitation',
43
            with: [
44
                'invitation' => $this->invitation,
45
                'invitedBy' => $this->invitation->invitedBy,
46
                'registerUrl' => route('register', ['token' => $this->invitation->token]),
47
                'expiresAt' => $this->invitation->expires_at,
48
                'siteName' => config('app.name'),
49
            ],
50
        );
51
    }
52
53
    /**
54
     * Get the attachments for the message.
55
     *
56
     * @return array<int, \Illuminate\Mail\Mailables\Attachment>
57
     */
58
    public function attachments(): array
59
    {
60
        return [];
61
    }
62
}
63