73 lines
1.5 KiB
PHP
73 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Notifications\Notification;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
|
|
class DocumentNotification extends Notification
|
|
{
|
|
use Queueable;
|
|
public $document_id;
|
|
public $type;
|
|
public $action;
|
|
public $link;
|
|
|
|
/**
|
|
* Create a new notification instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct($document_id, $type, $action, $link)
|
|
{
|
|
$this->document_id = $document_id;
|
|
$this->type = $type;
|
|
$this->action = $action;
|
|
$this->link = $link;
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* Get the notification's delivery channels.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return array
|
|
*/
|
|
public function via($notifiable)
|
|
{
|
|
return [customDocumentChannel::class, 'broadcast'];
|
|
// return ['database'];
|
|
}
|
|
|
|
/**
|
|
* Get the mail representation of the notification.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
|
*/
|
|
public function toDatabase($notifiable)
|
|
{
|
|
return [
|
|
'type' => $this->type,
|
|
'action' => $this->action,
|
|
'link' => $this->link,
|
|
'workflow_document_id' => $this->document_id
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the array representation of the notification.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return array
|
|
*/
|
|
public function toArray($notifiable)
|
|
{
|
|
return [
|
|
];
|
|
}
|
|
}
|