Files
cpo_test/laravel/app/Notifications/TaskOverdueNotification.php
2026-02-06 23:26:56 +07:00

57 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Notifications;
use App\Models\Task;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
final class TaskOverdueNotification extends Notification implements ShouldQueue
{
use Queueable;
/**
* Create a new notification instance.
*/
public function __construct(
public Task $task
) {
}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail(): MailMessage
{
return (new MailMessage)
->subject('Task overdue')
->line("Task «{$this->task->title}» overdue");
}
/**
* Get the array representation of the notification.
*
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
//
];
}
}