Certified/app/Notifications/SubscriptionActivatedNotification.php
2026-08-09 16:33:53 +02:00

38 lines
1.2 KiB
PHP

<?php
namespace App\Notifications;
use App\Models\Subscription;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class SubscriptionActivatedNotification extends Notification
{
use Queueable;
public function __construct(public Subscription $subscription) {}
/**
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(User $notifiable): MailMessage
{
$message = (new MailMessage)
->subject(__('Your Certified subscription is active'))
->greeting(__('Hello :name,', ['name' => $notifiable->name]))
->line(__('Thanks! Your payment was received and your :plan subscription is active.', ['plan' => $this->subscription->plan->label()]));
if ($this->subscription->current_period_ends_at) {
$message->line(__('Your subscription runs until :date.', ['date' => $this->subscription->current_period_ends_at->toFormattedDateString()]));
}
return $message->action(__('View your subscription'), route('billing.edit'));
}
}