App\Notifications\TaskActionNotification::toArray PHP Method

toArray() public method

Get the array representation of the notification.
public toArray ( mixed $notifiable ) : array
$notifiable mixed
return array
    public function toArray($notifiable)
    {
        switch ($this->action) {
            case 'created':
                $text = lang::get('misc.notifications.task.created', ['title' => $this->task->title, 'creator' => $this->task->taskCreator->name]);
                break;
            case 'updated_status':
                $text = lang::get('misc.notifications.task.status', ['title' => $this->task->title, 'username' => Auth()->user()->name]);
                break;
            case 'updated_time':
                $text = lang::get('misc.notifications.task.time', ['title' => $this->task->title, 'username' => Auth()->user()->name]);
                break;
            case 'updated_assign':
                $text = lang::get('misc.notifications.task.assign', ['title' => $this->task->title, 'username' => Auth()->user()->name]);
                break;
            default:
                break;
        }
        return ['assigned_user' => $notifiable->id, 'created_user' => $this->task->fk_user_id_created, 'message' => $text, 'type' => Tasks::class, 'type_id' => $this->task->id, 'url' => url('tasks/' . $this->task->id), 'action' => $this->action];
    }