first&last
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?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 RequestAssignedNotification 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),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user