mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
First or fail for company record in short
This commit is contained in:
parent
f6c62f3607
commit
dbe22cf5fa
@ -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…
Reference in New Issue
Block a user