61 lines
1.7 KiB
PHP
61 lines
1.7 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Enums\Site\ProjectSection;
|
|
use App\Models\ProjectFeedback;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
final class ReviewAdded extends Notification implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
/**
|
|
* Create a new notification instance.
|
|
*/
|
|
public function __construct(
|
|
private readonly ProjectFeedback $feedback
|
|
) { }
|
|
|
|
/**
|
|
* Get the notification's delivery channels.
|
|
*
|
|
* @return array<int, string>
|
|
*/
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['mail'];
|
|
}
|
|
|
|
/**
|
|
* Get the mail representation of the notification.
|
|
*/
|
|
public function toMail(object $notifiable): MailMessage
|
|
{
|
|
$project = $this->feedback->project;
|
|
|
|
return (new MailMessage)
|
|
->subject(__('notification.Review Added: :name', ['name' => $project->name]))
|
|
->line(__('notification.Added a new review.'))
|
|
->action(__('notification.Project :name', ['name' => $project->name]), \url(ProjectSection::Home->url($project)))
|
|
->line( __('site.attributes.name') . ': ' . $this->feedback->name)
|
|
->line( __('site.attributes.email') . ': ' . $this->feedback->email)
|
|
->line(__('site.attributes.message') . ': ' . $this->feedback->message);
|
|
}
|
|
|
|
/**
|
|
* Get the array representation of the notification.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(object $notifiable): array
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
}
|