34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Notifications;
|
||
|
|
|
||
|
|
use Illuminate\Bus\Queueable;
|
||
|
|
use Illuminate\Notifications\Notification;
|
||
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
||
|
|
use App\Models\Inspection;
|
||
|
|
|
||
|
|
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 [
|
||
|
|
'type' => 'inspection_completed',
|
||
|
|
'inspection_id' => $this->inspection->id,
|
||
|
|
'project_id' => $this->inspection->project_id,
|
||
|
|
'feature_name' => $this->inspection->feature?->name ?? '—',
|
||
|
|
'template_name' => $this->inspection->template?->name ?? '—',
|
||
|
|
'result' => $this->inspection->result,
|
||
|
|
'message' => "Inspección completada en '{$this->inspection->feature?->name}': " . ($this->inspection->result ?? 'sin resultado'),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|