2026-06-18 12:51:41 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Notifications;
|
|
|
|
|
|
|
|
|
|
use App\Models\IssueComment;
|
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
|
|
|
|
|
class IssueCommentedNotification extends Notification
|
|
|
|
|
{
|
|
|
|
|
use Queueable;
|
|
|
|
|
|
|
|
|
|
public function __construct(public IssueComment $comment) {}
|
|
|
|
|
|
|
|
|
|
public function via($notifiable): array
|
|
|
|
|
{
|
|
|
|
|
return ['database'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function toArray($notifiable): array
|
|
|
|
|
{
|
|
|
|
|
$issue = $this->comment->issue;
|
|
|
|
|
|
|
|
|
|
return [
|
2026-08-28 13:04:28 +02:00
|
|
|
'type' => 'issue_commented',
|
|
|
|
|
'issue_id' => $this->comment->issue_id,
|
2026-06-18 12:51:41 +02:00
|
|
|
'project_id' => $issue?->project_id,
|
2026-08-28 13:04:28 +02:00
|
|
|
'author' => $this->comment->user?->name,
|
|
|
|
|
'message' => "{$this->comment->user?->name} comentó en '{$issue?->title}': ".Str::limit($this->comment->body, 60),
|
2026-06-18 12:51:41 +02:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|