1 | <?php |
||||
2 | |||||
3 | namespace Adminetic\Announcement\Notifications; |
||||
4 | |||||
5 | use Adminetic\Announcement\Models\Admin\Announcement; |
||||
6 | use Illuminate\Bus\Queueable; |
||||
7 | use Illuminate\Notifications\Messages\SlackMessage; |
||||
8 | use Illuminate\Notifications\Notification; |
||||
9 | use League\HTMLToMarkdown\HtmlConverter; |
||||
10 | |||||
11 | class SlackAnnouncementNotification extends Notification |
||||
12 | { |
||||
13 | use Queueable; |
||||
14 | |||||
15 | protected $announcement; |
||||
16 | |||||
17 | /** |
||||
18 | * Create a new notification instance. |
||||
19 | * |
||||
20 | * @return void |
||||
21 | */ |
||||
22 | public function __construct(Announcement $announcement) |
||||
23 | { |
||||
24 | $this->announcement = $announcement; |
||||
25 | } |
||||
26 | |||||
27 | /** |
||||
28 | * Get the notification's delivery channels. |
||||
29 | * |
||||
30 | * @param mixed $notifiable |
||||
31 | * @return array |
||||
32 | */ |
||||
33 | public function via($notifiable) |
||||
0 ignored issues
–
show
|
|||||
34 | { |
||||
35 | return ['slack']; |
||||
36 | } |
||||
37 | |||||
38 | /** |
||||
39 | * Get the Slack representation of the notification. |
||||
40 | * |
||||
41 | * @param mixed $notifiable |
||||
42 | * @return \Illuminate\Notifications\Messages\SlackMessage |
||||
43 | */ |
||||
44 | public function toSlack($notifiable) |
||||
0 ignored issues
–
show
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
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
45 | { |
||||
46 | return (new SlackMessage) |
||||
47 | ->from(setting('title', config('adminetic.title', 'Adminetic')).' - '.$this->announcement->user->name ?? 'N/A') |
||||
0 ignored issues
–
show
The function
setting was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
48 | ->image(getLogo()) |
||||
0 ignored issues
–
show
The function
getLogo was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
49 | ->content((new HtmlConverter())->convert($this->announcement->body)); |
||||
50 | } |
||||
51 | } |
||||
52 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.