Files
fotospiel-app/app/Notifications/Packages/TenantPackageExpiredNotification.php
2025-11-01 13:19:07 +01:00

44 lines
1.6 KiB
PHP

<?php
namespace App\Notifications\Packages;
use App\Models\TenantPackage;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class TenantPackageExpiredNotification extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(private readonly TenantPackage $tenantPackage) {}
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(object $notifiable): MailMessage
{
$tenant = $this->tenantPackage->tenant;
$package = $this->tenantPackage->package;
$url = url('/tenant/billing');
return (new MailMessage)
->subject(__('emails.package_limits.package_expired.subject', [
'package' => $package?->getNameForLocale() ?? $package?->name ?? __('emails.package_limits.package_fallback'),
]))
->greeting(__('emails.package_limits.package_expired.greeting', [
'name' => $tenant?->name ?? __('emails.package_limits.team_fallback'),
]))
->line(__('emails.package_limits.package_expired.body', [
'package' => $package?->getNameForLocale() ?? $package?->name ?? __('emails.package_limits.package_fallback'),
'date' => optional($this->tenantPackage->expires_at)->toFormattedDateString(),
]))
->action(__('emails.package_limits.package_expired.action'), $url)
->line(__('emails.package_limits.footer'));
}
}