Completed
Branch dev4 (2f299a)
by Ron
08:25
created

TechTipComment::__construct()   A

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 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Notifications;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Notifications\Notification;
7
use Illuminate\Contracts\Queue\ShouldQueue;
8
use Illuminate\Notifications\Messages\MailMessage;
9
10
class TechTipComment extends Notification
11
{
12
    use Queueable;
13
14
    protected $details;
15
    
16
    //  Constructor receives basic Tech Tip data
17
    public function __construct($details)
18
    {
19
        $this->details = $details;
20
    }
21
22
    //  Notifications sent via dashboard notification
23
    public function via($notifiable)
24
    {
25
        return ['database'];
26
    }
27
28
    //  Email Notification
29
    public function toMail($notifiable)
30
    {
31
//        return (new MailMessage)
32
//                    ->line('The introduction to the notification.')
33
//                    ->action('Notification Action', url('/'))
34
//                    ->line('Thank you for using our application!');
35
    }
36
37
    //  Dashboard Notification
38
    public function toArray($notifiable)
39
    {
40
        return [
41
            'type'    => 'warning',
42
            'message' => $this->details['user'].' added a comment to your Tech Tip - '.$this->details['title'],
43
            'link'    => url(route('tip.details', ['id' => $this->details['tip_id'], 'name' => urlencode($this->details['title'])]))
44
        ];
45
    }
46
}
47