Files
construprogress/app/Notifications/InspectionCompletedNotification.php
T

33 lines
963 B
PHP
Raw Normal View History

<?php
namespace App\Notifications;
2026-08-28 13:04:28 +02:00
use App\Models\Inspection;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class InspectionCompletedNotification extends Notification
{
use Queueable;
public function __construct(public Inspection $inspection) {}
public function via($notifiable): array
{
return ['database'];
}
public function toArray($notifiable): array
{
return [
2026-08-28 13:04:28 +02:00
'type' => 'inspection_completed',
'inspection_id' => $this->inspection->id,
2026-08-28 13:04:28 +02:00
'project_id' => $this->inspection->project_id,
'feature_name' => $this->inspection->feature?->name ?? '—',
'template_name' => $this->inspection->template?->name ?? '—',
2026-08-28 13:04:28 +02:00
'result' => $this->inspection->result,
'message' => "Inspección completada en '{$this->inspection->feature?->name}': ".($this->inspection->result ?? 'sin resultado'),
];
}
}