Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 6 |
| SlackNotifications | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 6 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| via | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| toDatabase | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| toSlack | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| <?php | |
| namespace App\Notifications; | |
| use Illuminate\Bus\Queueable; | |
| use Illuminate\Notifications\Notification; | |
| use Illuminate\Contracts\Queue\ShouldQueue; | |
| use Illuminate\Notifications\Messages\MailMessage; | |
| use Illuminate\Notifications\Messages\SlackMessage; | |
| class SlackNotifications extends Notification implements ShouldQueue | |
| { | |
| use Queueable; | |
| protected $slackMessage; | |
| /** | |
| * Create a new notification instance. | |
| * | |
| * @return void | |
| */ | |
| public function __construct($slackMessage) | |
| { | |
| $this->slackMessage = $slackMessage; | |
| } | |
| /** | |
| * Get the notification's delivery channels. | |
| * | |
| * @param mixed $notifiable | |
| * @return array | |
| */ | |
| public function via($notifiable) | |
| { | |
| return ['slack']; | |
| } | |
| // /** | |
| // * Get the mail representation of the notification. | |
| // * | |
| // * @param mixed $notifiable | |
| // * @return \Illuminate\Notifications\Messages\MailMessage | |
| // */ | |
| // public function toMail($notifiable) | |
| // { | |
| // return (new MailMessage) | |
| // ->line('The introduction to the notification.') | |
| // ->action('Notification Action', url('/')) | |
| // ->line('Thank you for using our application!'); | |
| // } | |
| public function toDatabase($notifiable) | |
| { | |
| return [ | |
| $this->slackMessage | |
| ]; | |
| } | |
| // /** | |
| // * Get the array representation of the notification. | |
| // * | |
| // * @param mixed $notifiable | |
| // * @return array | |
| // */ | |
| // public function toArray($notifiable) | |
| // { | |
| // return [ | |
| // // | |
| // ]; | |
| // } | |
| /** | |
| * Get the Slack representation of the notification. | |
| * | |
| * @param mixed $notifiable | |
| * @return SlackMessage | |
| */ | |
| public function toSlack($notifiable) | |
| { | |
| return (new SlackMessage) | |
| ->content($this->slackMessage); | |
| } | |
| } |