32 lines
823 B
PHP
32 lines
823 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Notifications;
|
||
|
|
|
||
|
|
use Illuminate\Bus\Queueable;
|
||
|
|
use Illuminate\Notifications\Notification;
|
||
|
|
use App\Models\Issue;
|
||
|
|
|
||
|
|
class IssueReportedNotification extends Notification
|
||
|
|
{
|
||
|
|
use Queueable;
|
||
|
|
|
||
|
|
public function __construct(public Issue $issue) {}
|
||
|
|
|
||
|
|
public function via($notifiable): array
|
||
|
|
{
|
||
|
|
return ['database'];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function toArray($notifiable): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'type' => 'issue_reported',
|
||
|
|
'issue_id' => $this->issue->id,
|
||
|
|
'project_id' => $this->issue->project_id,
|
||
|
|
'feature_name' => $this->issue->feature?->name ?? '—',
|
||
|
|
'priority' => $this->issue->priority,
|
||
|
|
'message' => "Nuevo issue '{$this->issue->title}' (prioridad: {$this->issue->priority})",
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|