mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 00:24:36 -04: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)
|
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)
|
if(!$company->enable_shop_api)
|
||||||
return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403);
|
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)
|
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)
|
if(!$company->enable_shop_api)
|
||||||
return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403);
|
return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user