the MailMessage builders to use view(). This keeps the existing copy/labels but aligns the look with resources/views/ emails/partials/layout.blade.php. I also switched the customer add‑on receipt notification to reuse the existing branded view and added missing translations for the upload pipeline alert.
56 lines
2.1 KiB
PHP
56 lines
2.1 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 UploadPipelineFailed extends Notification implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(private readonly array $context) {}
|
|
|
|
public function via(object $notifiable): array
|
|
{
|
|
$channels = [];
|
|
|
|
if (config('storage-monitor.alert_recipients.mail')) {
|
|
$channels[] = 'mail';
|
|
}
|
|
|
|
return $channels;
|
|
}
|
|
|
|
public function toMail(object $notifiable): MailMessage
|
|
{
|
|
$context = $this->context;
|
|
$job = $context['job'] ?? 'n/a';
|
|
$queue = $context['queue'] ?? 'n/a';
|
|
$eventId = $context['event_id'] ?? 'n/a';
|
|
$photoId = $context['photo_id'] ?? 'n/a';
|
|
$exception = $context['exception'] ?? 'n/a';
|
|
$timestamp = now()->toDateTimeString();
|
|
|
|
return (new MailMessage)
|
|
->subject(__('emails.upload_pipeline_failed.subject', ['job' => $job]))
|
|
->view('emails.notifications.basic', [
|
|
'title' => __('emails.upload_pipeline_failed.subject', ['job' => $job]),
|
|
'preheader' => __('emails.upload_pipeline_failed.preheader'),
|
|
'heroTitle' => __('emails.upload_pipeline_failed.hero_title'),
|
|
'heroSubtitle' => __('emails.upload_pipeline_failed.hero_subtitle'),
|
|
'lines' => [
|
|
__('emails.upload_pipeline_failed.line_job', ['job' => $job]),
|
|
__('emails.upload_pipeline_failed.line_queue', ['queue' => $queue]),
|
|
__('emails.upload_pipeline_failed.line_event', ['event' => $eventId]),
|
|
__('emails.upload_pipeline_failed.line_photo', ['photo' => $photoId]),
|
|
__('emails.upload_pipeline_failed.line_exception', ['exception' => $exception]),
|
|
__('emails.upload_pipeline_failed.line_time', ['time' => $timestamp]),
|
|
],
|
|
'footer' => __('emails.upload_pipeline_failed.footer'),
|
|
]);
|
|
}
|
|
}
|