diff --git a/app/Http/Controllers/Shop/ProductController.php b/app/Http/Controllers/Shop/ProductController.php index 2dcb7afbc770..70434ad9140c 100644 --- a/app/Http/Controllers/Shop/ProductController.php +++ b/app/Http/Controllers/Shop/ProductController.php @@ -34,7 +34,7 @@ class ProductController extends BaseController */ public function index(Request $request) { - $company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->first(); + $company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->firstOrFail(); if(!$company->enable_shop_api) return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403); @@ -46,7 +46,7 @@ class ProductController extends BaseController public function show(Request $request, string $product_key) { - $company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->first(); + $company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->firstOrFail(); if(!$company->enable_shop_api) return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403);