App\Notifications\LeadActionNotification::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.lead.created', ['title' => $this->lead->title, 'creator' => $this->lead->createdBy->name]);
                break;
            case 'updated_status':
                $text = Lang::get('misc.notifications.lead.status', ['title' => $this->lead->title, 'username' => Auth()->user()->name]);
                break;
            case 'updated_deadline':
                $text = Lang::get('misc.notifications.lead.deadline', ['title' => $this->lead->title, 'username' => Auth()->user()->name]);
                break;
            case 'updated_assign':
                $text = Lang::get('misc.notifications.lead.assign', ['username' => Auth()->user()->name]);
                break;
            default:
                break;
        }
        return ['assigned_user' => $notifiable->id, 'created_user' => $this->lead->fk_user_id_created, 'message' => $text, 'type' => Leads::class, 'type_id' => $this->lead->id, 'url' => url('leads/' . $this->lead->id), 'action' => $this->action];
    }