mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-24 01:50:38 +00:00
added subscription demo generators
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Users\Actions;
|
||||
|
||||
use App\Users\Models\User;
|
||||
@@ -22,7 +21,6 @@ class AutoSubscribeForMeteredBillingAction
|
||||
|
||||
// Create user balance
|
||||
if (intval($settings['allowed_registration_bonus'])) {
|
||||
|
||||
// Create balance with bonus amount
|
||||
$user->balance()->create([
|
||||
'amount' => $settings['registration_bonus_amount'],
|
||||
@@ -39,17 +37,12 @@ class AutoSubscribeForMeteredBillingAction
|
||||
'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([
|
||||
'plan_id' => $plan->id,
|
||||
@@ -59,4 +52,4 @@ class AutoSubscribeForMeteredBillingAction
|
||||
'type' => 'pre-paid',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Users\Actions;
|
||||
|
||||
use App\Users\Models\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Contracts\Auth\StatefulGuard;
|
||||
use VueFileManager\Subscription\Domain\Plans\Models\Plan;
|
||||
|
||||
class CreateNewUserAction extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
protected StatefulGuard $guard,
|
||||
protected StatefulGuard $guard,
|
||||
protected AutoSubscribeForMeteredBillingAction $autoSubscribeForMeteredBilling,
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate and create a new user.
|
||||
@@ -25,7 +24,7 @@ class CreateNewUserAction extends Controller
|
||||
]);
|
||||
|
||||
// Check if account registration is enabled
|
||||
if (!intval($settings['registration'])) {
|
||||
if (! intval($settings['registration'])) {
|
||||
abort(401);
|
||||
}
|
||||
|
||||
@@ -47,14 +46,14 @@ class CreateNewUserAction extends Controller
|
||||
}
|
||||
|
||||
// Mark as verified if verification is disabled
|
||||
if (!$data->password || !intval($settings['user_verification'])) {
|
||||
if (! $data->password || ! intval($settings['user_verification'])) {
|
||||
$user->markEmailAsVerified();
|
||||
}
|
||||
|
||||
event(new Registered($user));
|
||||
|
||||
// Log in if verification is disabled
|
||||
if (!$data->password || !intval($settings['user_verification'])) {
|
||||
if (! $data->password || ! intval($settings['user_verification'])) {
|
||||
$this->guard->login($user);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class UserSetting extends Model
|
||||
|
||||
// Return default avatar
|
||||
foreach (config('vuefilemanager.avatar_sizes') as $item) {
|
||||
$link[$item['name']] = url("/assets/images/default-avatar.png");
|
||||
$link[$item['name']] = url('/assets/images/default-avatar.png');
|
||||
}
|
||||
|
||||
return $link;
|
||||
|
||||
Reference in New Issue
Block a user