Files
website/website/app/Notifications/SubscriptionCreatedNotification.php
Claude Dev 89fac519c3 Add notification system, notification bell, admin/account tests, and footer legal links
- 6 notification classes: PaymentSucceeded, PaymentFailed, SubscriptionCreated,
  SubscriptionCancelled, ServiceProvisioned, InvoiceGenerated (mail + database)
- Wire notifications to existing event listeners + new subscription listeners
- NotificationBell component in Account and Admin layouts
- NotificationController with index, markAsRead, markAllAsRead endpoints
- 62 new Pest tests: AdminPanelTest (admin CRUD) + CustomerAccountTest (account features)
- Add Legal links column to marketing footer
- 114 tests passing (623 assertions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 13:45:10 -05:00

51 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Laravel\Cashier\Subscription;
class SubscriptionCreatedNotification extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
public Subscription $subscription,
) {}
/** @return array<int, string> */
public function via(object $notifiable): array
{
return ['mail', 'database'];
}
public function toMail(object $notifiable): MailMessage
{
$dashboardUrl = 'https://'.config('app.domains.account').'/dashboard';
return (new MailMessage)
->subject('Subscription Confirmed')
->greeting("Welcome aboard, {$notifiable->name}!")
->line("Your subscription **{$this->subscription->type}** has been created successfully.")
->line('Your service is being provisioned and will be ready shortly.')
->action('Go to Dashboard', $dashboardUrl)
->line('Thank you for choosing EZSCALE!');
}
/** @return array<string, mixed> */
public function toArray(object $notifiable): array
{
return [
'type' => 'subscription_created',
'subscription_id' => $this->subscription->id,
'subscription_type' => $this->subscription->type,
'message' => "Subscription \"{$this->subscription->type}\" created successfully.",
];
}
}