mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 14:07:32 -04:00 
			
		
		
		
	check shop is enabled
This commit is contained in:
		
							parent
							
								
									2b9610ea02
								
							
						
					
					
						commit
						52065fb963
					
				| @ -53,6 +53,9 @@ class ClientController extends BaseController | ||||
|     { | ||||
|         $company = Company::where('company_key', $request->header('X-API-COMPANY_KEY'))->first(); | ||||
| 
 | ||||
|         if(!$company->enable_shop_api) | ||||
|             return response()->json(['message' => 'Shop is disabled', 'errors' => []],403); | ||||
| 
 | ||||
|         $contact = ClientContact::with('client') | ||||
|                             ->where('company_id', $company->id) | ||||
|                             ->where('contact_key', $contact_key) | ||||
| @ -65,6 +68,9 @@ class ClientController extends BaseController | ||||
|     { | ||||
|         $company = Company::where('company_key', $request->header('X-API-COMPANY_KEY'))->first(); | ||||
| 
 | ||||
|         if(!$company->enable_shop_api) | ||||
|             return response()->json(['message' => 'Shop is disabled', 'errors' => []],403); | ||||
|          | ||||
|         app('queue')->createPayloadUsing(function () use ($company) { | ||||
|             return ['db' => $company->db]; | ||||
|         }); | ||||
|  | ||||
| @ -54,6 +54,9 @@ class InvoiceController extends BaseController | ||||
|     { | ||||
|         $company = Company::where('company_key', $request->header('X-API-COMPANY_KEY'))->first(); | ||||
| 
 | ||||
|         if(!$company->enable_shop_api) | ||||
|             return response()->json(['message' => 'Shop is disabled', 'errors' => []],403); | ||||
| 
 | ||||
|         $invitation = InvoiceInvitation::with(['invoice']) | ||||
|                                         ->where('company_id', $company->id) | ||||
|                                         ->where('key',$invitation_key) | ||||
| @ -65,12 +68,16 @@ class InvoiceController extends BaseController | ||||
| 
 | ||||
|     public function store(StoreInvoiceRequest $request) | ||||
|     { | ||||
|                  | ||||
|         $company = Company::where('company_key', $request->header('X-API-COMPANY_KEY'))->first(); | ||||
| 
 | ||||
|         if(!$company->enable_shop_api) | ||||
|             return response()->json(['message' => 'Shop is disabled', 'errors' => []],403); | ||||
| 
 | ||||
|         app('queue')->createPayloadUsing(function () use ($company) { | ||||
|             return ['db' => $company->db]; | ||||
|         }); | ||||
|          | ||||
|         $company = Company::where('company_key', $request->header('X-API-COMPANY_KEY'))->first(); | ||||
| 
 | ||||
|         $client = Client::find($request->input('client_id')); | ||||
| 
 | ||||
|         $invoice = $this->invoice_repo->save($request->all(), InvoiceFactory::create($company_id, $company->owner()->id)); | ||||
|  | ||||
| @ -36,6 +36,9 @@ class ProductController extends BaseController | ||||
|     { | ||||
|         $company = Company::where('company_key', $request->header('X-API-COMPANY_KEY'))->first(); | ||||
| 
 | ||||
|         if(!$company->enable_shop_api) | ||||
|             return response()->json(['message' => 'Shop is disabled', 'errors' => []],403); | ||||
| 
 | ||||
|         $products = Product::where('company_id', $company->id); | ||||
| 
 | ||||
|         return $this->listResponse($products); | ||||
| @ -45,6 +48,9 @@ class ProductController extends BaseController | ||||
|     { | ||||
|         $company = Company::where('company_key', $request->header('X-API-COMPANY_KEY'))->first(); | ||||
| 
 | ||||
|         if(!$company->enable_shop_api) | ||||
|             return response()->json(['message' => 'Shop is disabled', 'errors' => []],403); | ||||
|          | ||||
|         $product = Product::where('company_id', $company->id) | ||||
|                             ->where('product_key', $product_key) | ||||
|                             ->first(); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user