32 lines
809 B
PHP
32 lines
809 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Notifications;
|
||
|
|
|
||
|
|
use App\Models\Comment;
|
||
|
|
use App\Models\Task;
|
||
|
|
use Illuminate\Bus\Queueable;
|
||
|
|
use Illuminate\Notifications\Notification;
|
||
|
|
|
||
|
|
class TaskCommentNotification extends Notification
|
||
|
|
{
|
||
|
|
use Queueable;
|
||
|
|
|
||
|
|
public function __construct(public Task $task, public Comment $comment) {}
|
||
|
|
|
||
|
|
public function via($notifiable): array
|
||
|
|
{
|
||
|
|
return ['database'];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function toArray($notifiable): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'type' => 'task_comment',
|
||
|
|
'task_id' => $this->task->id,
|
||
|
|
'project_id' => $this->task->project_id,
|
||
|
|
'comment_id' => $this->comment->id,
|
||
|
|
'message' => "Nuevo comentario en '{$this->task->title}' por {$this->comment->user->name}: ".substr($this->comment->body, 0, 100),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|