Deploy Ladill QR Plus / deploy (push) Failing after 1s
Utility QR types only (URL, WiFi, link list, business, app download) with SSO, Billing API integration, public /q resolver, and qr-plus:import for platform migration. vCard and commerce types stay on the platform. Co-authored-by: Cursor <cursoragent@cursor.com>
69 lines
2.0 KiB
PHP
69 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Models\HostingAccount;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class HostingExpiringNotification extends Notification implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
private readonly HostingAccount $account,
|
|
private readonly int $daysRemaining,
|
|
) {
|
|
}
|
|
|
|
public function via($notifiable): array
|
|
{
|
|
return ['mail', 'database'];
|
|
}
|
|
|
|
public function toMail($notifiable): MailMessage
|
|
{
|
|
return (new MailMessage())
|
|
->subject($this->subjectLine())
|
|
->view('mail.notifications.hosting-expiring', [
|
|
'account' => $this->account,
|
|
'daysRemaining' => $this->daysRemaining,
|
|
'renewUrl' => route('hosting.accounts.show', $this->account),
|
|
]);
|
|
}
|
|
|
|
public function toArray($notifiable): array
|
|
{
|
|
$label = $this->account->primary_domain ?: $this->account->username;
|
|
|
|
return [
|
|
'title' => $this->headline(),
|
|
'message' => "Hosting for {$label} expires in {$this->daysRemaining} days.",
|
|
'icon' => 'hosting',
|
|
'url' => route('hosting.accounts.show', $this->account),
|
|
];
|
|
}
|
|
|
|
private function subjectLine(): string
|
|
{
|
|
$label = $this->account->primary_domain ?: $this->account->username;
|
|
|
|
return match (true) {
|
|
$this->daysRemaining <= 1 => "Hosting expires tomorrow: {$label}",
|
|
$this->daysRemaining <= 7 => "Urgent: hosting for {$label} expires in {$this->daysRemaining} days",
|
|
default => "Hosting renewal reminder: {$label}",
|
|
};
|
|
}
|
|
|
|
private function headline(): string
|
|
{
|
|
return match (true) {
|
|
$this->daysRemaining <= 1 => 'Hosting expires soon',
|
|
$this->daysRemaining <= 7 => 'Urgent hosting renewal',
|
|
default => 'Hosting renewal reminder',
|
|
};
|
|
}
|
|
}
|