diff --git a/application/controllers/api/v1/Admins_api_v1.php b/application/controllers/api/v1/Admins_api_v1.php index 20a22bb6..12d79150 100644 --- a/application/controllers/api/v1/Admins_api_v1.php +++ b/application/controllers/api/v1/Admins_api_v1.php @@ -52,7 +52,7 @@ class Admins_api_v1 extends EA_Controller { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $admins = empty($keyword) ? $this->admins_model->get(NULL, $limit, $offset, $order_by) @@ -67,9 +67,9 @@ class Admins_api_v1 extends EA_Controller { $this->admins_model->only($admin, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->admins_model->attach($admin, $attach); + $this->admins_model->load($admin, $with); } } @@ -92,7 +92,7 @@ class Admins_api_v1 extends EA_Controller { { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $admin = $this->admins_model->find($id); @@ -103,9 +103,9 @@ class Admins_api_v1 extends EA_Controller { $this->admins_model->only($admin, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->admins_model->attach($admin, $attach); + $this->admins_model->load($admin, $with); } if ( ! $admin) diff --git a/application/controllers/api/v1/Appointments_api_v1.php b/application/controllers/api/v1/Appointments_api_v1.php index 06f12afd..0758b799 100644 --- a/application/controllers/api/v1/Appointments_api_v1.php +++ b/application/controllers/api/v1/Appointments_api_v1.php @@ -58,7 +58,7 @@ class Appointments_api_v1 extends EA_Controller { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $appointments = empty($keyword) ? $this->appointments_model->get(NULL, $limit, $offset, $order_by) @@ -75,9 +75,9 @@ class Appointments_api_v1 extends EA_Controller { $this->appointments_model->only($appointment, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->appointments_model->attach($appointment, $attach); + $this->appointments_model->load($appointment, $with); } } @@ -100,7 +100,7 @@ class Appointments_api_v1 extends EA_Controller { { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $appointment = $this->appointments_model->find($id); @@ -111,9 +111,9 @@ class Appointments_api_v1 extends EA_Controller { $this->appointments_model->only($appointment, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->appointments_model->attach($appointment, $attach); + $this->appointments_model->load($appointment, $with); } if ( ! $appointment) diff --git a/application/controllers/api/v1/Categories_api_v1.php b/application/controllers/api/v1/Categories_api_v1.php index 2fb5b15c..5d4152db 100644 --- a/application/controllers/api/v1/Categories_api_v1.php +++ b/application/controllers/api/v1/Categories_api_v1.php @@ -52,7 +52,7 @@ class Categories_api_v1 extends EA_Controller { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $service_categories = empty($keyword) ? $this->service_categories_model->get(NULL, $limit, $offset, $order_by) @@ -67,9 +67,9 @@ class Categories_api_v1 extends EA_Controller { $this->service_categories_model->only($service_category, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->service_categories_model->attach($service_category, $attach); + $this->service_categories_model->load($service_category, $with); } } @@ -92,7 +92,7 @@ class Categories_api_v1 extends EA_Controller { { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $service_category = $this->service_categories_model->find($id); @@ -103,9 +103,9 @@ class Categories_api_v1 extends EA_Controller { $this->service_categories_model->only($service_category, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->service_categories_model->attach($service_category, $attach); + $this->service_categories_model->load($service_category, $with); } if ( ! $service_category) diff --git a/application/controllers/api/v1/Customers_api_v1.php b/application/controllers/api/v1/Customers_api_v1.php index ab1c51aa..98e3aa5c 100644 --- a/application/controllers/api/v1/Customers_api_v1.php +++ b/application/controllers/api/v1/Customers_api_v1.php @@ -52,7 +52,7 @@ class Customers_api_v1 extends EA_Controller { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $customers = empty($keyword) ? $this->customers_model->get(NULL, $limit, $offset, $order_by) @@ -67,9 +67,9 @@ class Customers_api_v1 extends EA_Controller { $this->customers_model->only($customer, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->customers_model->attach($customer, $attach); + $this->customers_model->load($customer, $with); } } diff --git a/application/controllers/api/v1/Providers_api_v1.php b/application/controllers/api/v1/Providers_api_v1.php index d030827a..c5ba3b8c 100644 --- a/application/controllers/api/v1/Providers_api_v1.php +++ b/application/controllers/api/v1/Providers_api_v1.php @@ -52,7 +52,7 @@ class Providers_api_v1 extends EA_Controller { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $providers = empty($keyword) ? $this->providers_model->get(NULL, $limit, $offset, $order_by) @@ -67,9 +67,9 @@ class Providers_api_v1 extends EA_Controller { $this->providers_model->only($provider, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->providers_model->attach($provider, $attach); + $this->providers_model->load($provider, $with); } } @@ -92,7 +92,7 @@ class Providers_api_v1 extends EA_Controller { { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $provider = $this->providers_model->find($id); @@ -103,9 +103,9 @@ class Providers_api_v1 extends EA_Controller { $this->providers_model->only($provider, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->providers_model->attach($provider, $attach); + $this->providers_model->load($provider, $with); } if ( ! $provider) diff --git a/application/controllers/api/v1/Secretaries_api_v1.php b/application/controllers/api/v1/Secretaries_api_v1.php index c5acbf03..c2e4ca16 100644 --- a/application/controllers/api/v1/Secretaries_api_v1.php +++ b/application/controllers/api/v1/Secretaries_api_v1.php @@ -52,7 +52,7 @@ class Secretaries_api_v1 extends EA_Controller { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $secretaries = empty($keyword) ? $this->secretaries_model->get(NULL, $limit, $offset, $order_by) @@ -67,9 +67,9 @@ class Secretaries_api_v1 extends EA_Controller { $this->secretaries_model->only($secretary, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->secretaries_model->attach($secretary, $attach); + $this->secretaries_model->load($secretary, $with); } } diff --git a/application/controllers/api/v1/Services_api_v1.php b/application/controllers/api/v1/Services_api_v1.php index 8b9f6d49..b9d0b18e 100644 --- a/application/controllers/api/v1/Services_api_v1.php +++ b/application/controllers/api/v1/Services_api_v1.php @@ -52,7 +52,7 @@ class Services_api_v1 extends EA_Controller { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $services = empty($keyword) ? $this->services_model->get(NULL, $limit, $offset, $order_by) @@ -67,9 +67,9 @@ class Services_api_v1 extends EA_Controller { $this->services_model->only($service, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->services_model->attach($service, $attach); + $this->services_model->load($service, $with); } } @@ -92,7 +92,7 @@ class Services_api_v1 extends EA_Controller { { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $service = $this->services_model->find($id); @@ -103,9 +103,9 @@ class Services_api_v1 extends EA_Controller { $this->services_model->only($service, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->services_model->attach($service, $attach); + $this->services_model->load($service, $with); } if ( ! $service) diff --git a/application/controllers/api/v1/Unavailabilities_api_v1.php b/application/controllers/api/v1/Unavailabilities_api_v1.php index 6578b36e..b5769287 100644 --- a/application/controllers/api/v1/Unavailabilities_api_v1.php +++ b/application/controllers/api/v1/Unavailabilities_api_v1.php @@ -52,7 +52,7 @@ class Unavailabilities_api_v1 extends EA_Controller { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $unavailabilities = empty($keyword) ? $this->unavailabilities_model->get(NULL, $limit, $offset, $order_by) @@ -67,9 +67,9 @@ class Unavailabilities_api_v1 extends EA_Controller { $this->unavailabilities_model->only($unavailability, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->unavailabilities_model->attach($unavailability, $attach); + $this->unavailabilities_model->load($unavailability, $with); } } @@ -92,7 +92,7 @@ class Unavailabilities_api_v1 extends EA_Controller { { $fields = $this->api->request_fields(); - $attach = $this->api->request_attach(); + $with = $this->api->request_with(); $unavailability = $this->unavailabilities_model->find($id); @@ -103,9 +103,9 @@ class Unavailabilities_api_v1 extends EA_Controller { $this->unavailabilities_model->only($unavailability, $fields); } - if ( ! empty($attach)) + if ( ! empty($with)) { - $this->unavailabilities_model->attach($unavailability, $attach); + $this->unavailabilities_model->load($unavailability, $with); } if ( ! $unavailability) diff --git a/application/libraries/Api.php b/application/libraries/Api.php index 299ed320..49c9e0f3 100644 --- a/application/libraries/Api.php +++ b/application/libraries/Api.php @@ -281,19 +281,19 @@ class Api { } /** - * Get the provided "attach" array of the current request. + * Get the provided "with" array of the current request. * * @return array|null */ - public function request_attach(): ?array + public function request_with(): ?array { - $attach = request('attach'); + $with = request('with'); - if ( ! $attach) + if ( ! $with) { return NULL; } - return array_map('trim', explode(',', $attach)); + return array_map('trim', explode(',', $with)); } }