mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 08:12:15 +00:00
code style fix
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use App\Http\Requests\User\UpdateUserPasswordRequest;
|
||||
use App\Http\Resources\InvoiceCollection;
|
||||
use App\Http\Resources\StorageDetailResource;
|
||||
use App\Http\Resources\UserResource;
|
||||
use App\Http\Resources\UserStorageResource;
|
||||
use App\Services\DemoService;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\DemoService;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\UserResource;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Http\Resources\InvoiceCollection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Http\Resources\UserStorageResource;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use App\Http\Requests\User\UpdateUserPasswordRequest;
|
||||
|
||||
class AccountController extends Controller
|
||||
{
|
||||
@@ -72,12 +70,14 @@ class AccountController extends Controller
|
||||
// TODO: pridat validator do requestu
|
||||
$validator = Validator::make($request->all(), [
|
||||
'avatar' => 'sometimes|file',
|
||||
'name' => 'string',
|
||||
'value' => 'string',
|
||||
'name' => 'string',
|
||||
'value' => 'string',
|
||||
]);
|
||||
|
||||
// Return error
|
||||
if ($validator->fails()) abort(400, 'Bad input');
|
||||
if ($validator->fails()) {
|
||||
abort(400, 'Bad input');
|
||||
}
|
||||
|
||||
// Get user
|
||||
$user = Auth::user();
|
||||
@@ -90,7 +90,7 @@ class AccountController extends Controller
|
||||
$user
|
||||
->settings()
|
||||
->update([
|
||||
'avatar' => store_avatar($request, 'avatar')
|
||||
'avatar' => store_avatar($request, 'avatar'),
|
||||
]);
|
||||
|
||||
return response('Saved!', 204);
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Payments\RegisterNewPaymentMethodRequest;
|
||||
use App\Http\Resources\PaymentCardCollection;
|
||||
use App\Http\Resources\PaymentCardResource;
|
||||
use App\Http\Resources\PaymentDefaultCardResource;
|
||||
use App\Services\DemoService;
|
||||
use App\Services\StripeService;
|
||||
use Auth;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use App\Services\DemoService;
|
||||
use App\Services\StripeService;
|
||||
use Laravel\Cashier\PaymentMethod;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use App\Http\Resources\PaymentCardResource;
|
||||
use App\Http\Resources\PaymentCardCollection;
|
||||
use App\Http\Resources\PaymentDefaultCardResource;
|
||||
use App\Http\Requests\Payments\RegisterNewPaymentMethodRequest;
|
||||
|
||||
class PaymentMethodsController extends Controller
|
||||
{
|
||||
|
||||
public function __construct(StripeService $stripe)
|
||||
{
|
||||
$this->stripe = $stripe;
|
||||
@@ -32,7 +30,7 @@ class PaymentMethodsController extends Controller
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
if (!$user->hasPaymentMethod()) {
|
||||
if (! $user->hasPaymentMethod()) {
|
||||
return abort(204, 'User don\'t have any payment methods');
|
||||
}
|
||||
|
||||
@@ -40,15 +38,11 @@ class PaymentMethodsController extends Controller
|
||||
$slug_default_payment_method = 'default-payment-methods-user-' . $user->id;
|
||||
|
||||
if (Cache::has($slug_payment_methods) && Cache::has($slug_default_payment_method)) {
|
||||
|
||||
$defaultPaymentMethod = Cache::get($slug_default_payment_method);
|
||||
$paymentMethodsMapped = Cache::get($slug_payment_methods);
|
||||
|
||||
} else {
|
||||
|
||||
// Get default payment method
|
||||
$defaultPaymentMethod = Cache::rememberForever($slug_default_payment_method, function () use ($user) {
|
||||
|
||||
$defaultPaymentMethodObject = $user->defaultPaymentMethod();
|
||||
|
||||
return $defaultPaymentMethodObject instanceof PaymentMethod
|
||||
@@ -58,7 +52,6 @@ class PaymentMethodsController extends Controller
|
||||
|
||||
// filter payment methods without default payment
|
||||
$paymentMethodsMapped = Cache::rememberForever($slug_payment_methods, function () use ($defaultPaymentMethod, $user) {
|
||||
|
||||
$paymentMethods = $user->paymentMethods()->filter(function ($paymentMethod) use ($defaultPaymentMethod) {
|
||||
return $paymentMethod->id !== $defaultPaymentMethod->id;
|
||||
});
|
||||
@@ -70,10 +63,10 @@ class PaymentMethodsController extends Controller
|
||||
});
|
||||
}
|
||||
|
||||
if (!$user->card_brand || !$user->stripe_id || is_null($paymentMethodsMapped) && is_null($paymentMethodsMapped)) {
|
||||
if (! $user->card_brand || ! $user->stripe_id || is_null($paymentMethodsMapped) && is_null($paymentMethodsMapped)) {
|
||||
return [
|
||||
'default' => null,
|
||||
'others' => [],
|
||||
'others' => [],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -81,7 +74,7 @@ class PaymentMethodsController extends Controller
|
||||
'default' => $defaultPaymentMethod instanceof PaymentMethod
|
||||
? new PaymentCardResource($defaultPaymentMethod)
|
||||
: new PaymentDefaultCardResource($defaultPaymentMethod),
|
||||
'others' => new PaymentCardCollection($paymentMethodsMapped),
|
||||
'others' => new PaymentCardCollection($paymentMethodsMapped),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -108,7 +101,7 @@ class PaymentMethodsController extends Controller
|
||||
// Clear cached payment methods
|
||||
cache_forget_many([
|
||||
'payment-methods-user-' . $user->id,
|
||||
'default-payment-methods-user-' . $user->id
|
||||
'default-payment-methods-user-' . $user->id,
|
||||
]);
|
||||
|
||||
return response('Done', 204);
|
||||
@@ -159,7 +152,7 @@ class PaymentMethodsController extends Controller
|
||||
// Clear cached payment methods
|
||||
cache_forget_many([
|
||||
'payment-methods-user-' . $user->id,
|
||||
'default-payment-methods-user-' . $user->id
|
||||
'default-payment-methods-user-' . $user->id,
|
||||
]);
|
||||
|
||||
return response('Done!', 204);
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Subscription\StoreUpgradeAccountRequest;
|
||||
use App\Http\Resources\UserSubscription;
|
||||
use App\Services\DemoService;
|
||||
use App\Models\User;
|
||||
use App\Services\StripeService;
|
||||
use Auth;
|
||||
use App\Models\User;
|
||||
use Stripe\SetupIntent;
|
||||
use App\Services\DemoService;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Services\StripeService;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use App\Http\Resources\UserSubscription;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Stripe\SetupIntent;
|
||||
use App\Http\Requests\Subscription\StoreUpgradeAccountRequest;
|
||||
|
||||
class SubscriptionController extends Controller
|
||||
{
|
||||
@@ -34,7 +33,8 @@ class SubscriptionController extends Controller
|
||||
public function setup_intent()
|
||||
{
|
||||
return response(
|
||||
$this->stripe->getSetupIntent(Auth::user()), 201
|
||||
$this->stripe->getSetupIntent(Auth::user()),
|
||||
201
|
||||
);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class SubscriptionController extends Controller
|
||||
{
|
||||
$user = User::find(Auth::id());
|
||||
|
||||
if (!$user->subscription('main')) {
|
||||
if (! $user->subscription('main')) {
|
||||
return abort(204, 'User don\'t have any subscription');
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class SubscriptionController extends Controller
|
||||
|
||||
// Update user storage limit
|
||||
$user->settings()->update([
|
||||
'storage_capacity' => $plan['product']['metadata']['capacity']
|
||||
'storage_capacity' => $plan['product']['metadata']['capacity'],
|
||||
]);
|
||||
|
||||
return response('Done!', 204);
|
||||
|
||||
Reference in New Issue
Block a user