Files
Nexora/app/Notifications/DocumentStatusChanged.php
Javi 356f56eebd
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
first commit
2025-04-23 00:14:33 +06:00

55 lines
1.3 KiB
PHP

<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class DocumentStatusChanged extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*/
public function __construct(public Document $document, public string $action)
{
//
}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['database', 'mail'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject("Document status changed: {$this->document->name}")
->line("The document '{$this->document->name}' has been {$this->action}.")
->action('View Document', route('documents.show', $this->document));
}
/**
* Get the array representation of the notification.
*
* @return array<string, mixed>
*/
public function toArray(object $notifiable): array
{
return [
//
];
}
}