diff --git a/app/Http/Controllers/ShopController.php b/app/Http/Controllers/ShopController.php index db89f2b32..7ce3958f2 100644 --- a/app/Http/Controllers/ShopController.php +++ b/app/Http/Controllers/ShopController.php @@ -85,6 +85,19 @@ public function getShop($id) { */ public function getShopStock(ShopManager $service, $id, $stockId) { $shop = Shop::where('id', $id)->where('is_active', 1)->first(); + if (!$shop) { + abort(404); + } + + if (count(getLimits($shop))) { + $service = new LimitManager; + if (!$service->checkLimits($shop)) { + flash($service->errors()->getMessages()['error'][0])->error(); + + return redirect()->to('shops'); + } + } + $stock = ShopStock::with('item')->where('id', $stockId)->where('shop_id', $id)->first(); $user = Auth::user(); @@ -98,10 +111,6 @@ public function getShopStock(ShopManager $service, $id, $stockId) { $userOwned = UserItem::where('user_id', $user->id)->where('item_id', $stock->item->id)->where('count', '>', 0)->get(); } - if (!$shop) { - abort(404); - } - return view('shops._stock_modal', [ 'shop' => $shop, 'stock' => $stock,