ConfirmationTokenGenerated::via()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 1
crap 1
1
<?php namespace JobApis\JobsToMail\Notifications;
2
3
use Illuminate\Bus\Queueable;
4
use Illuminate\Notifications\Notification;
5
use Illuminate\Contracts\Queue\ShouldQueue;
6
use Illuminate\Notifications\Messages\MailMessage;
7
use JobApis\JobsToMail\Models\Token;
8
9
class ConfirmationTokenGenerated extends Notification implements ShouldQueue
10
{
11
    use Queueable;
12
13
    /**
14
     * @var Token
15
     */
16
    protected $token;
17
18
    /**
19
     * Create a new notification instance.
20
     *
21
     * @param Token $token
22
     *
23
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
24
     */
25 5
    public function __construct(Token $token)
26
    {
27 5
        $this->token = $token;
28 5
    }
29
30
    /**
31
     * Get the notification's delivery channels.
32
     *
33
     * @param  mixed  $notifiable
34
     * @return array
35
     */
36 1
    public function via($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    {
38 1
        return ['mail'];
39
    }
40
41
    /**
42
     * Get the mail representation of the notification.
43
     *
44
     * @param  mixed  $notifiable
45
     * @return \Illuminate\Notifications\Messages\MailMessage
46
     */
47 1
    public function toMail($notifiable)
48
    {
49 1
        $url = config('app.url').'auth/confirm/'.$this->token;
50 1
        $message = new MailMessage;
51 1
        $message->viewData['user_id'] = $notifiable->id;
52
        return $message
53 1
            ->subject('Confirm your email address to start receiving jobs')
54 1
            ->greeting('Thank you for joining '.config('app.name'))
55 1
            ->line('In order to start sending you jobs we need you to confirm your email address.')
56 1
            ->action('Confirm Email', $url)
57 1
            ->line('Once confirmed, you will start receiving emails within 24 hours.');
58
    }
59
}
60