скрытие магазина
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Http\Requests\Admin\SaveShopProductRequest;
|
||||
use App\Models\ShopCategory;
|
||||
use App\Models\ShopProduct;
|
||||
use App\Services\ShopCatalogService;
|
||||
use App\Services\StoreAvailabilityService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
@@ -18,7 +19,11 @@ class ShopController extends Controller
|
||||
{
|
||||
use BuildsPortalProps;
|
||||
|
||||
public function index(Request $request, ShopCatalogService $catalog): Response
|
||||
public function index(
|
||||
Request $request,
|
||||
ShopCatalogService $catalog,
|
||||
StoreAvailabilityService $availability,
|
||||
): Response
|
||||
{
|
||||
$categories = $catalog->categories();
|
||||
|
||||
@@ -68,6 +73,8 @@ class ShopController extends Controller
|
||||
->all(),
|
||||
'categoryStoreUrl' => route('admin.shop.categories.store'),
|
||||
'productStoreUrl' => route('admin.shop.products.store'),
|
||||
'shopEnabled' => $availability->isEnabled(),
|
||||
'availabilityUpdateUrl' => route('admin.shop.availability.update'),
|
||||
'productTypes' => collect([
|
||||
1 => 'Предмет',
|
||||
3 => 'Маунт',
|
||||
@@ -80,6 +87,20 @@ class ShopController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function updateAvailability(Request $request, StoreAvailabilityService $availability): RedirectResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'enabled' => ['required', 'boolean'],
|
||||
]);
|
||||
|
||||
$enabled = (bool) $validated['enabled'];
|
||||
$availability->setEnabled($enabled);
|
||||
|
||||
return back()->with('status', $enabled
|
||||
? 'Магазин и пополнение включены.'
|
||||
: 'Магазин и пополнение выключены.');
|
||||
}
|
||||
|
||||
public function storeCategory(SaveShopCategoryRequest $request, ShopCatalogService $catalog): RedirectResponse
|
||||
{
|
||||
$catalog->createCategory($request->validated());
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Http\Requests\ChangePasswordRequest;
|
||||
use App\Services\AzerothCoreAccountService;
|
||||
use App\Services\BalanceService;
|
||||
use App\Services\GameClientDownloadService;
|
||||
use App\Services\StoreAvailabilityService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
@@ -14,7 +15,12 @@ use Throwable;
|
||||
|
||||
class CabinetController extends Controller
|
||||
{
|
||||
public function index(Request $request, AzerothCoreAccountService $accounts, BalanceService $balances): Response
|
||||
public function index(
|
||||
Request $request,
|
||||
AzerothCoreAccountService $accounts,
|
||||
BalanceService $balances,
|
||||
StoreAvailabilityService $storeAvailability,
|
||||
): Response
|
||||
{
|
||||
$user = $request->user();
|
||||
$balance = $balances->balance($user->id);
|
||||
@@ -48,6 +54,7 @@ class CabinetController extends Controller
|
||||
'filename' => config('moonwell.client.object_key'),
|
||||
],
|
||||
'wallet' => [
|
||||
'deposit_enabled' => $storeAvailability->isEnabled(),
|
||||
'amount' => $balance,
|
||||
'formatted_amount' => number_format((float) $balance, 2, ',', ' '),
|
||||
'minimum_deposit' => (float) config('services.robokassa.minimum_amount'),
|
||||
|
||||
@@ -75,11 +75,6 @@ class LandingController extends Controller
|
||||
'playUrl' => $playUrl,
|
||||
'posts' => $posts,
|
||||
'newsIndexUrl' => route('news.index'),
|
||||
'tweaks' => [
|
||||
'variant' => 'forest',
|
||||
'particles' => true,
|
||||
'moon' => true,
|
||||
],
|
||||
'registerEndpoint' => route('game-account.store'),
|
||||
'legalUrls' => [
|
||||
'offer_published' => (bool) config('moonwell.legal.offer_published'),
|
||||
|
||||
@@ -62,11 +62,6 @@ class MainController extends Controller
|
||||
],
|
||||
'playUrl' => $user !== null ? route('cabinet.client') : '#join',
|
||||
'posts' => $posts,
|
||||
'tweaks' => [
|
||||
'variant' => 'forest',
|
||||
'particles' => true,
|
||||
'moon' => true,
|
||||
],
|
||||
'registerEndpoint' => route('game-account.store'),
|
||||
'csrfToken' => csrf_token(),
|
||||
'auth' => [
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\RobokassaService;
|
||||
use App\Services\StoreAvailabilityService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
@@ -10,8 +11,18 @@ use Illuminate\View\View;
|
||||
|
||||
class PaymentController extends Controller
|
||||
{
|
||||
public function create(Request $request, RobokassaService $robokassa): View
|
||||
public function create(
|
||||
Request $request,
|
||||
RobokassaService $robokassa,
|
||||
StoreAvailabilityService $storeAvailability,
|
||||
): View|RedirectResponse
|
||||
{
|
||||
if (! $storeAvailability->isEnabled()) {
|
||||
return redirect()
|
||||
->route('cabinet.index')
|
||||
->with('error', 'Пополнение временно недоступно.');
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'amount' => [
|
||||
'required',
|
||||
|
||||
Reference in New Issue
Block a user