Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 32 |
| ApplyLeaveNotifications | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
42 | |
0.00% |
0 / 32 |
| __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 |
6 | |
0.00% |
0 / 25 |
|||
| toArray | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| toDatabase | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
| <?php | |
| namespace App\Notifications; | |
| use Illuminate\Bus\Queueable; | |
| use Illuminate\Contracts\Queue\ShouldQueue; | |
| use Illuminate\Notifications\Messages\MailMessage; | |
| use Illuminate\Notifications\Notification; | |
| use Illuminate\Support\Facades\URL; | |
| class ApplyLeaveNotifications 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','mail']; | |
| } | |
| /** | |
| * Get the mail representation of the notification. | |
| * | |
| * @param mixed $notifiable | |
| * @return \Illuminate\Notifications\Messages\MailMessage | |
| */ | |
| public function toMail($notifiable) | |
| { | |
| $userDetail = 'User Detail'; | |
| $subjectLine = $this->arr[0]; | |
| $team = 'Team - ' . $this->arr[1]; | |
| $name = 'Name - ' . $this->arr[2]; | |
| $leave_type = 'Leave Type - ' . $this->arr[3]; | |
| if($this->arr[3] == "Full Day"){ | |
| $arr4 = 'From Date - ' . $this->arr[4]; | |
| $arr5 = 'To Date - ' . $this->arr[5]; | |
| }else{ | |
| $arr4 = 'Half Day Type - ' . $this->arr[4]; | |
| $arr5 = 'Date - ' . $this->arr[5]; | |
| } | |
| $getUrl = 'leave-report.index'; | |
| $url = URL::temporarySignedRoute( | |
| $getUrl, | |
| now()->addDays(1)); | |
| return (new MailMessage) | |
| ->subject($subjectLine) | |
| ->greeting($subjectLine) | |
| ->line($userDetail) | |
| ->line($team) | |
| ->line($name) | |
| ->line($leave_type) | |
| ->line($arr4) | |
| ->line($arr5) | |
| ->action('Notification Action',$url ) | |
| ->line('Thank you for using our application!'); | |
| } | |
| /** | |
| * Get the array representation of the notification. | |
| * | |
| * @param mixed $notifiable | |
| * @return array | |
| */ | |
| public function toArray($notifiable) | |
| { | |
| return [ | |
| // | |
| ]; | |
| } | |
| public function toDatabase($notifiable) | |
| { | |
| return [ | |
| 'notification' => $this->arr[6], | |
| 'message' => $this->arr[7], | |
| 'actionUrl' => $this->arr[8] | |
| ]; | |
| } | |
| } |