Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 34
RequestAttendanceNotifications
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 6
42
0.00% covered (danger)
0.00%
0 / 34
 __construct
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 via
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 toMail
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 22
 toDatabase
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
 toArray
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 toSlack
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 5
<?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 RequestAttendanceNotifications 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];
        $date = 'Date - ' . $this->arr[3];
        $checkin = 'Check In - ' . $this->arr[4];
        $checkout = 'Check Out - ' . $this->arr[5];
        $getUrl = $this->arr[8];
        $url = URL::temporarySignedRoute(
            $getUrl,
            now()->addDays(1));
        return (new MailMessage)
            ->subject($subjectLine)
            ->greeting($subjectLine)
            ->line($userDetail)
            ->line($team)
            ->line($name)
            ->line($date)
            ->line($checkin)
            ->line($checkout)
            ->action('Notification Action', $url)
            ->line('Thank you for using our application!');
    }
    public function toDatabase($notifiable)
    {
        return [
            'notification' => $this->arr[6],
            'message' => $this->arr[7],
            'actionUrl' => $this->arr[8]
        ];
    }
    /**
     * 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];
        $subjectLine = $this->arr[3];
        return (new SlackMessage)
            ->content($team.' '.$name.' '.$subjectLine);
    }
}