Files
AirService_potyk/app/Notifications/RequestOverdueNotification.php
2026-03-20 15:47:17 +05:00

42 lines
1.2 KiB
PHP

<?php
namespace App\Notifications;
use App\Models\ServiceRequest;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class RequestOverdueNotification extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(private readonly ServiceRequest $request)
{
}
public function via(object $notifiable): array
{
return ['database', 'mail'];
}
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject('Просроченная заявка')
->line("Заявка {$this->request->ticket_number} просрочена.")
->action('Открыть заявку', route('requests.show', $this->request));
}
public function toArray(object $notifiable): array
{
return [
'title' => 'Просроченная заявка',
'message' => "Заявка {$this->request->ticket_number} просрочена",
'request_id' => $this->request->id,
'url' => route('requests.show', $this->request),
];
}
}