mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-27 18:40:39 +00:00
credit bonus after user registration
This commit is contained in:
@@ -14,13 +14,41 @@ class AutoSubscribeForMeteredBillingAction
|
||||
->where('type', 'metered')
|
||||
->first();
|
||||
|
||||
// TODO: add bonus
|
||||
// Get settings
|
||||
$settings = get_settings([
|
||||
'allowed_registration_bonus',
|
||||
'registration_bonus_amount',
|
||||
]);
|
||||
|
||||
// Create user balance
|
||||
$user->balance()->create([
|
||||
'amount' => 0,
|
||||
'currency' => $plan->currency,
|
||||
]);
|
||||
if (intval($settings['allowed_registration_bonus'])) {
|
||||
|
||||
// Create balance with bonus amount
|
||||
$user->balance()->create([
|
||||
'amount' => $settings['registration_bonus_amount'],
|
||||
'currency' => $plan->currency,
|
||||
]);
|
||||
|
||||
// Store transaction bonus
|
||||
$user->transactions()->create([
|
||||
'status' => 'completed',
|
||||
'type' => 'credit',
|
||||
'driver' => 'system',
|
||||
'note' => __('Bonus'),
|
||||
'currency' => $plan->currency,
|
||||
'amount' => $settings['registration_bonus_amount'],
|
||||
]);
|
||||
} else {
|
||||
|
||||
// Create balance with 0 amount
|
||||
$user->balance()->create([
|
||||
'currency' => $plan->currency,
|
||||
]);
|
||||
}
|
||||
|
||||
// Store transaction
|
||||
if (intval($settings['allowed_registration_bonus'])) {
|
||||
}
|
||||
|
||||
// Create user subscription
|
||||
$user->subscription()->create([
|
||||
|
||||
@@ -13,9 +13,7 @@ class CreateNewUserAction extends Controller
|
||||
public function __construct(
|
||||
protected StatefulGuard $guard,
|
||||
protected AutoSubscribeForMeteredBillingAction $autoSubscribeForMeteredBilling,
|
||||
)
|
||||
{
|
||||
}
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Validate and create a new user.
|
||||
|
||||
@@ -53,7 +53,12 @@ class UserSetting extends Model
|
||||
return $link;
|
||||
}
|
||||
|
||||
return null;
|
||||
// Return default avatar
|
||||
foreach (config('vuefilemanager.avatar_sizes') as $item) {
|
||||
$link[$item['name']] = url("/assets/images/default-avatar.png");
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
public function user(): HasOne
|
||||
|
||||
Reference in New Issue
Block a user