43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications\Packages;
|
|
|
|
use App\Models\Tenant;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class TenantCreditsLowNotification extends Notification implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
private readonly Tenant $tenant,
|
|
private readonly int $balance,
|
|
private readonly int $threshold,
|
|
) {}
|
|
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['mail'];
|
|
}
|
|
|
|
public function toMail(object $notifiable): MailMessage
|
|
{
|
|
$url = url('/tenant/billing');
|
|
|
|
return (new MailMessage)
|
|
->subject(__('emails.package_limits.credits_low.subject'))
|
|
->greeting(__('emails.package_limits.credits_low.greeting', [
|
|
'name' => $this->tenant->name ?? __('emails.package_limits.team_fallback'),
|
|
]))
|
|
->line(__('emails.package_limits.credits_low.body', [
|
|
'balance' => $this->balance,
|
|
'threshold' => $this->threshold,
|
|
]))
|
|
->action(__('emails.package_limits.credits_low.action'), $url)
|
|
->line(__('emails.package_limits.footer'));
|
|
}
|
|
}
|