2026-08-03 13:44:10 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Notifications;
|
|
|
|
|
|
2026-08-28 13:04:28 +02:00
|
|
|
use App\Models\Inspection;
|
2026-08-03 13:44:10 +02:00
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
|
|
|
|
|
|
class InspectionUpdatedNotification extends Notification
|
|
|
|
|
{
|
|
|
|
|
use Queueable;
|
|
|
|
|
|
|
|
|
|
public function __construct(public Inspection $inspection, public array $changes = []) {}
|
|
|
|
|
|
|
|
|
|
public function via($notifiable): array
|
|
|
|
|
{
|
|
|
|
|
return ['database'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function toArray($notifiable): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
2026-08-28 13:04:28 +02:00
|
|
|
'type' => 'inspection_updated',
|
2026-08-03 13:44:10 +02:00
|
|
|
'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 ?? '—',
|
2026-08-03 13:44:10 +02:00
|
|
|
'template_name' => $this->inspection->template?->name ?? '—',
|
2026-08-28 13:04:28 +02:00
|
|
|
'result' => $this->inspection->result,
|
|
|
|
|
'changes' => $this->changes,
|
|
|
|
|
'message' => "Inspección actualizada en '{$this->inspection->feature?->name}'",
|
2026-08-03 13:44:10 +02:00
|
|
|
];
|
|
|
|
|
}
|
2026-08-28 13:04:28 +02:00
|
|
|
}
|