Skip to content

Commit

Permalink
Merge pull request #32 from Ne-wt/master
Browse files Browse the repository at this point in the history
Fixing error 'Undefined variable: $stock'
  • Loading branch information
itinerare committed Oct 26, 2020
2 parents 12ad047 + d6162d0 commit 4c8f652
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/Http/Controllers/ShopController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ public function getShopStock(ShopManager $service, $id, $stockId)
$shop = Shop::where('id', $id)->where('is_active', 1)->first();
if(!$shop) abort(404);

$stock = ShopStock::with('item')->where('id', $stockId)->where('shop_id', $id)->first();

if(Auth::user()){
$purchaseLimitReached = $service->checkPurchaseLimitReached($stock, Auth::user());
} else $purchaseLimitReached = false;

return view('shops._stock_modal', [
'shop' => $shop,
'stock' => $stock = ShopStock::with('item')->where('id', $stockId)->where('shop_id', $id)->first(),
'stock' => $stock,
'purchaseLimitReached' => $purchaseLimitReached
]);
}
Expand Down

0 comments on commit 4c8f652

Please sign in to comment.