added SubscriptionWasCreatedNotification

This commit is contained in:
Čarodej
2022-03-16 11:08:57 +01:00
parent 9a6abbd6e8
commit bc197cbb5e
3 changed files with 57 additions and 1 deletions
@@ -0,0 +1,47 @@
<?php
namespace Domain\Subscriptions\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use VueFileManager\Subscription\Domain\Subscriptions\Models\Subscription;
class SubscriptionWasCreatedNotification extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
public Subscription $subscription,
) {}
public function via(): array
{
return ['mail', 'database', 'broadcast'];
}
public function toMail(): MailMessage
{
return (new MailMessage)
->subject(__("Your subscription {$this->subscription->plan->name} has been successfully created"))
->greeting(__('Hi there'))
->line(__("You have been successfully subscribed to your {$this->subscription->plan->name} subscription. Now you can take full advantage of our platform."))
->action(__('Go to Subscription'), url('/user/settings/billing'));
}
public function toArray(): array
{
return [
'category' => 'subscription-created',
'title' => 'Subscription Has Been Created',
'description' => "Your subscription {$this->subscription->plan->name} has been successfully created",
'action' => [
'type' => 'route',
'params' => [
'route' => 'Billing',
'button' => 'Show Billing',
],
],
];
}
}