3
3
namespace Modules \Article \Notifications ;
4
4
5
5
use Illuminate \Bus \Queueable ;
6
- use Illuminate \Notifications \Notification ;
7
6
use Illuminate \Contracts \Queue \ShouldQueue ;
8
7
use Illuminate \Notifications \Messages \MailMessage ;
9
8
use Illuminate \Notifications \Messages \SlackMessage ;
9
+ use Illuminate \Notifications \Notification ;
10
10
use Modules \Article \Entities \Comment ;
11
11
12
12
class NewCommentAdded extends Notification implements ShouldQueue
@@ -29,6 +29,7 @@ public function __construct(Comment $comment)
29
29
* Get the notification's delivery channels.
30
30
*
31
31
* @param mixed $notifiable
32
+ *
32
33
* @return array
33
34
*/
34
35
public function via ($ notifiable )
@@ -40,14 +41,15 @@ public function via($notifiable)
40
41
* Get the mail representation of the notification.
41
42
*
42
43
* @param mixed $notifiable
44
+ *
43
45
* @return \Illuminate\Notifications\Messages\MailMessage
44
46
*/
45
47
public function toMail ($ notifiable )
46
48
{
47
49
$ comment = $ this ->comment ;
48
50
$ user = $ notifiable ;
49
51
50
- return (new MailMessage )
52
+ return (new MailMessage () )
51
53
->line ('The introduction to the notification. ' )
52
54
->action ('Notification Action ' , 'https://laravel.com ' )
53
55
->line ('Thank you for using our application! ' );
@@ -56,25 +58,26 @@ public function toMail($notifiable)
56
58
/**
57
59
* Get the Slack representation of the notification.
58
60
*
59
- * @param mixed $notifiable
61
+ * @param mixed $notifiable
62
+ *
60
63
* @return SlackMessage
61
64
*/
62
65
public function toSlack ($ notifiable )
63
66
{
64
67
$ comment = $ this ->comment ;
65
68
$ user = $ notifiable ;
66
69
67
- return (new SlackMessage )
70
+ return (new SlackMessage () )
68
71
->success ()
69
72
->from ('BlueCube ' , ':incoming_envelope: ' )
70
73
->content ('New Comment: ' .$ comment ->name .' | From: ' .$ comment ->user_name )
71
74
->attachment (function ($ attachment ) use ($ comment ) {
72
- $ attachment ->title ('Comment ' .$ comment ->id , route ('backend.comments.show ' ,$ comment ->id ))
75
+ $ attachment ->title ('Comment ' .$ comment ->id , route ('backend.comments.show ' , $ comment ->id ))
73
76
->fields ([
74
- 'Post ' => $ comment ->post_name ,
75
- 'User ' => $ comment ->user_name ,
77
+ 'Post ' => $ comment ->post_name ,
78
+ 'User ' => $ comment ->user_name ,
76
79
'Comment ' => $ comment ->name ,
77
- 'Status ' => $ comment ->status_label_text ,
80
+ 'Status ' => $ comment ->status_label_text ,
78
81
]);
79
82
});
80
83
}
@@ -83,6 +86,7 @@ public function toSlack($notifiable)
83
86
* Get the array representation of the notification.
84
87
*
85
88
* @param mixed $notifiable
89
+ *
86
90
* @return array
87
91
*/
88
92
public function toArray ($ notifiable )
@@ -91,14 +95,14 @@ public function toArray($notifiable)
91
95
$ user = $ notifiable ;
92
96
93
97
return [
94
- 'id ' => $ comment ->id ,
95
- 'name ' => $ comment ->name ,
96
- 'comment ' => $ comment ->comment ,
97
- 'post_id ' => $ comment ->post_id ,
98
+ 'id ' => $ comment ->id ,
99
+ 'name ' => $ comment ->name ,
100
+ 'comment ' => $ comment ->comment ,
101
+ 'post_id ' => $ comment ->post_id ,
98
102
'post_name ' => $ comment ->post_name ,
99
- 'user_id ' => $ comment ->user_id ,
103
+ 'user_id ' => $ comment ->user_id ,
100
104
'user_name ' => $ comment ->user_name ,
101
- 'status ' => $ comment ->status ,
105
+ 'status ' => $ comment ->status ,
102
106
];
103
107
}
104
108
}
0 commit comments