31 lines
698 B
PHP
31 lines
698 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Notifications;
|
||
|
|
|
||
|
|
use App\Models\Task;
|
||
|
|
use Illuminate\Bus\Queueable;
|
||
|
|
use Illuminate\Notifications\Notification;
|
||
|
|
|
||
|
|
class TaskAssignedNotification extends Notification
|
||
|
|
{
|
||
|
|
use Queueable;
|
||
|
|
|
||
|
|
public function __construct(public Task $task) {}
|
||
|
|
|
||
|
|
public function via($notifiable): array
|
||
|
|
{
|
||
|
|
return ['database'];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function toArray($notifiable): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'type' => 'task_assigned',
|
||
|
|
'task_id' => $this->task->id,
|
||
|
|
'project_id' => $this->task->project_id,
|
||
|
|
'priority' => $this->task->priority,
|
||
|
|
'message' => "Se te ha asignado la tarea '{$this->task->title}'",
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|