From 966a7124d6cb4bf8e5ef3da2010baba93c194764 Mon Sep 17 00:00:00 2001 From: saparatayev Date: Mon, 22 Nov 2021 18:17:07 +0500 Subject: [PATCH] additional models: products api --- .../controllers/api/ProductsApiController.php | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php index 1e92759a7..55ba19cfc 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php @@ -44,7 +44,9 @@ class ProductsAPIController extends Controller // $query = $this->Product::with('categories:id,name') $query = $this->Product::with([ 'translations:locale,model_id,attribute_data', - 'images:attachment_id,attachment_type,disk_name,file_name' + 'images:attachment_id,attachment_type,disk_name,file_name', + 'measure.translations:locale,model_id,attribute_data', + 'currency.translations:locale,model_id,attribute_data' ]) ->approvedAndFreshEndDate() ->orderBy('updated_at', $sortOrder); @@ -56,7 +58,9 @@ class ProductsAPIController extends Controller // ->with('categories:id,name') ->with([ 'translations:locale,model_id,attribute_data', - 'images:attachment_id,attachment_type,disk_name,file_name' + 'images:attachment_id,attachment_type,disk_name,file_name', + 'measure.translations:locale,model_id,attribute_data', + 'currency.translations:locale,model_id,attribute_data' ]) ->approvedAndFreshEndDate() ->orderBy('updated_at', $sortOrder); @@ -77,7 +81,9 @@ class ProductsAPIController extends Controller // ->with('categories:id,name') ->with([ 'translations:locale,model_id,attribute_data', - 'images:attachment_id,attachment_type,disk_name,file_name' + 'images:attachment_id,attachment_type,disk_name,file_name', + 'measure.translations:locale,model_id,attribute_data', + 'currency.translations:locale,model_id,attribute_data' ]) ->approvedAndFreshEndDate() ->orderBy('updated_at', $sortOrder); @@ -90,7 +96,9 @@ class ProductsAPIController extends Controller $query = $this->Product::searched($locale, $queryString) ->with([ 'translations:locale,model_id,attribute_data', - 'images:attachment_id,attachment_type,disk_name,file_name' + 'images:attachment_id,attachment_type,disk_name,file_name', + 'measure.translations:locale,model_id,attribute_data', + 'currency.translations:locale,model_id,attribute_data' ]) ->orderBy('updated_at', $sortOrder); } @@ -110,7 +118,12 @@ class ProductsAPIController extends Controller $data = $this->Product::with([ 'translations:locale,model_id,attribute_data', - 'images:attachment_id,attachment_type,disk_name,file_name' + 'images:attachment_id,attachment_type,disk_name,file_name', + 'measure.translations:locale,model_id,attribute_data', + 'currency.translations:locale,model_id,attribute_data', + 'payment_term.translations:locale,model_id,attribute_data', + 'delivery_term.translations:locale,model_id,attribute_data', + 'vendor:id,name,surname,email,username' ])->find($id); if ($data && $data->status == 'approved' && $data->ends_at >= \Carbon\Carbon::now()){