Last change
on this file was 0924b6c, checked in by Özkan İliyaz <iliyaz_96@…>, 4 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | namespace App\Notifications;
|
---|
4 |
|
---|
5 | use Illuminate\Bus\Queueable;
|
---|
6 | use Illuminate\Notifications\Notification;
|
---|
7 | use Illuminate\Notifications\Messages\MailMessage;
|
---|
8 |
|
---|
9 | class NewPostCreated extends Notification
|
---|
10 | {
|
---|
11 | use Queueable;
|
---|
12 |
|
---|
13 | protected $text;
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * Create a new notification instance.
|
---|
17 | *
|
---|
18 | * @return void
|
---|
19 | */
|
---|
20 | public function __construct($text)
|
---|
21 | {
|
---|
22 | $this->text = $text;
|
---|
23 | }
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Get the notification's delivery channels.
|
---|
27 | *
|
---|
28 | * @param mixed $notifiable
|
---|
29 | * @return array
|
---|
30 | */
|
---|
31 | public function via($notifiable)
|
---|
32 | {
|
---|
33 | return ['database'];
|
---|
34 | }
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Get the mail representation of the notification.
|
---|
38 | *
|
---|
39 | * @param mixed $notifiable
|
---|
40 | * @return \Illuminate\Notifications\Messages\MailMessage
|
---|
41 | */
|
---|
42 | public function toMail($notifiable)
|
---|
43 | {
|
---|
44 | return (new MailMessage)
|
---|
45 | ->line('The introduction to the notification.')
|
---|
46 | ->action('Notification Action', url('/'))
|
---|
47 | ->line('Thank you for using our application!');
|
---|
48 | }
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Get the array representation of the notification.
|
---|
52 | *
|
---|
53 | * @param mixed $notifiable
|
---|
54 | * @return array
|
---|
55 | */
|
---|
56 | public function toArray($notifiable)
|
---|
57 | {
|
---|
58 | return [
|
---|
59 | "url" => "/dashboard/posts",
|
---|
60 | "message" => $this->text
|
---|
61 | ];
|
---|
62 | }
|
---|
63 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.