Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 35 |
| AttendanceDetailNotifications | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
42 | |
0.00% |
0 / 35 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| via | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| toMail | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 18 |
|||
| toDatabase | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 7 |
|||
| toArray | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| toSlack | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 6 |
|||
| <?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; | |
| use Illuminate\Support\Facades\URL; | |
| class AttendanceDetailNotifications extends Notification implements Shouldqueue | |
| { | |
| use Queueable; | |
| protected $arr; | |
| /** | |
| * Create a new notification instance. | |
| * | |
| * @return void | |
| */ | |
| public function __construct($arr) | |
| { | |
| $this->arr = $arr; | |
| } | |
| /** | |
| * Get the notification's delivery channels. | |
| * | |
| * @param mixed $notifiable | |
| * @return array | |
| */ | |
| public function via($notifiable) | |
| { | |
| return ['database']; | |
| } | |
| /** | |
| * Get the mail representation of the notification. | |
| * | |
| * @param mixed $notifiable | |
| * @return \Illuminate\Notifications\Messages\MailMessage | |
| */ | |
| public function toMail($notifiable) | |
| { | |
| $userDetail = 'User Detail'; | |
| $team = 'Team - ' . $this->arr[0]; | |
| $name = 'Name - ' . $this->arr[1]; | |
| $checkTime = $this->arr[2]; | |
| $subjectLine = $this->arr[3]; | |
| $getUrl = 'home'; | |
| $url = URL::temporarySignedRoute( | |
| $getUrl, | |
| now()->addDays(1)); | |
| return (new MailMessage) | |
| ->subject($subjectLine) | |
| ->greeting($subjectLine) | |
| ->line($userDetail) | |
| ->line($team) | |
| ->line($name) | |
| ->line($checkTime) | |
| ->action('Notification Action', $url) | |
| ->line('Thank you for using our application!'); | |
| } | |
| public function toDatabase($notifiable) | |
| { | |
| $getUrl = 'home'; | |
| $url = URL::temporarySignedRoute( | |
| $getUrl, | |
| now()->addDays(1)); | |
| return [ | |
| 'notification' => $this->arr[4], | |
| 'message' => $this->arr[3], | |
| 'actionUrl' => $url | |
| ]; | |
| } | |
| /** | |
| * 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) | |
| { | |
| $team = 'Team - ' . $this->arr[0]; | |
| $name = 'Name - ' . $this->arr[1]; | |
| $checkTime = $this->arr[2]; | |
| $subjectLine = $this->arr[3]; | |
| return (new SlackMessage) | |
| ->content($team.' '.$name.' '.$checkTime.' '.$subjectLine); | |
| } | |
| } |