From 24c48d787bdb3842c907db70de231b12a01096a6 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 17 Oct 2024 14:27:02 -0400 Subject: [PATCH] country_state --- www-api/app/Controllers/WrenchResources.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/www-api/app/Controllers/WrenchResources.php b/www-api/app/Controllers/WrenchResources.php index 337cc3ae..579f59cc 100644 --- a/www-api/app/Controllers/WrenchResources.php +++ b/www-api/app/Controllers/WrenchResources.php @@ -768,10 +768,16 @@ class WrenchResources extends BaseController $raw_json = file_get_contents('php://input'); $in = json_decode($raw_json, true); $out =[]; + $outx = []; $in["action"] = -1; // - $out["country_state"]['US'] = $this->usStates(); - $out["country_state"]['NG'] = $this->ngStates(); - $out["country_state"]['CA'] = $this->caStates(); + $outx["country_state"]['US'] = $this->usStates(); + $outx["country_state"]['NG'] = $this->ngStates(); + $outx["country_state"]['CA'] = $this->caStates(); + if ( $in["country"] !=''){ + if (isset($outx["country_state"][$in["country"]])){ + $out["country_state"] = $outx["country_state"][$in["country"]]; + } + } return $this->summaryReturnData($in,$out); //json_encode( $final_out ); } private function usStates()