First or fail for company record in short
This commit is contained in:
parent
f6c62f3607
commit
dbe22cf5fa
1 changed files with 2 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue