Test Failed
Push — dev6 ( 5a7ea5...ab7c89 )
by Ron
20:20
created

NewTechTipCommentNotification   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
eloc 21
c 2
b 0
f 0
dl 0
loc 53
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A toMail() 0 8 1
A via() 0 3 1
A __construct() 0 5 1
A toArray() 0 8 1
1
<?php
2
3
namespace App\Notifications;
4
5
use App\Models\TechTip;
6
use App\Models\TechTipComment;
7
use App\Models\User;
8
use Illuminate\Bus\Queueable;
9
use Illuminate\Contracts\Queue\ShouldQueue;
10
use Illuminate\Notifications\Messages\MailMessage;
11
use Illuminate\Notifications\Notification;
12
13
class NewTechTipCommentNotification extends Notification
14
{
15
    use Queueable;
16
17
    protected $comment;
18
    protected $user;
19
    protected $tip;
20
21
    /**
22
     * Create a new notification instance
23
     */
24
    public function __construct(TechTipComment $comment, User $user)
25
    {
26
        $this->comment = $comment;
27
        $this->user    = $user;
28
        $this->tip     = TechTip::find($comment->tip_id);
29
    }
30
31
    /**
32
     * Get the notification's delivery channels
33
     */
34
    public function via($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

34
    public function via(/** @scrutinizer ignore-unused */ $notifiable)

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

Loading history...
35
    {
36
        return ['mail', 'database'];
37
    }
38
39
    /**
40
     * Get the mail representation of the notification
41
     */
42
    public function toMail($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

42
    public function toMail(/** @scrutinizer ignore-unused */ $notifiable)

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

Loading history...
43
    {
44
        return (new MailMessage)
45
                    ->greeting('Hello')
46
                    ->line($this->user->full_name.' has commented on Tech Tip - .'.$this->tip->subject)
47
                    ->line('The comment is: ')
48
                    ->line($this->comment->comment)
49
                    ->action('Click Here to review the comment', url(route('tech-tips.show', $this->tip->slug)));
50
    }
51
52
    /**
53
     * Get the array representation of the notification.
54
     *
55
     * @param  mixed  $notifiable
56
     * @return array
57
     */
58
    public function toArray($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

58
    public function toArray(/** @scrutinizer ignore-unused */ $notifiable)

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

Loading history...
59
    {
60
        return [
61
            'subject' => 'New Tech Tip Comment',
62
            'data'    => [
63
                'tip'     => $this->tip,
64
                'comment' => $this->comment,
65
                'user'    => $this->user,
66
            ],
67
        ];
68
    }
69
}
70