mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-25 18:20:38 +00:00
added registration bonus notification
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
namespace App\Users\Actions;
|
||||
|
||||
use App\Users\Models\User;
|
||||
use App\Users\Notifications\RegistrationBonusAddedNotification;
|
||||
use VueFileManager\Subscription\Domain\Plans\Models\Plan;
|
||||
|
||||
class AutoSubscribeForMeteredBillingAction
|
||||
@@ -36,6 +37,11 @@ class AutoSubscribeForMeteredBillingAction
|
||||
'currency' => $plan->currency,
|
||||
'amount' => $settings['registration_bonus_amount'],
|
||||
]);
|
||||
|
||||
// Send user bonus notification
|
||||
$bonus = format_currency($settings['registration_bonus_amount'], $plan->currency);
|
||||
|
||||
$user->notify(new RegistrationBonusAddedNotification($bonus));
|
||||
} else {
|
||||
// Create balance with 0 amount
|
||||
$user->balance()->create([
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace App\Users\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class RegistrationBonusAddedNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
public string $bonus
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*/
|
||||
public function via(mixed $notifiable): array
|
||||
{
|
||||
return ['database'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*/
|
||||
public function toArray(mixed $notifiable): array
|
||||
{
|
||||
return [
|
||||
'category' => 'gift',
|
||||
'title' => "You Received {$this->bonus}",
|
||||
'description' => "You received credit bonus $this->bonus for your registration. Happy spending!",
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user