forked from mirrors/easyappointments
Renamed the attach query paramter of API controllers to with
This commit is contained in:
parent
c68565e2c3
commit
e38df7452b
9 changed files with 47 additions and 47 deletions
|
@ -52,7 +52,7 @@ class Admins_api_v1 extends EA_Controller {
|
||||||
|
|
||||||
$fields = $this->api->request_fields();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$admins = empty($keyword)
|
$admins = empty($keyword)
|
||||||
? $this->admins_model->get(NULL, $limit, $offset, $order_by)
|
? $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);
|
$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();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$admin = $this->admins_model->find($id);
|
$admin = $this->admins_model->find($id);
|
||||||
|
|
||||||
|
@ -103,9 +103,9 @@ class Admins_api_v1 extends EA_Controller {
|
||||||
$this->admins_model->only($admin, $fields);
|
$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)
|
if ( ! $admin)
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Appointments_api_v1 extends EA_Controller {
|
||||||
|
|
||||||
$fields = $this->api->request_fields();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$appointments = empty($keyword)
|
$appointments = empty($keyword)
|
||||||
? $this->appointments_model->get(NULL, $limit, $offset, $order_by)
|
? $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);
|
$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();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$appointment = $this->appointments_model->find($id);
|
$appointment = $this->appointments_model->find($id);
|
||||||
|
|
||||||
|
@ -111,9 +111,9 @@ class Appointments_api_v1 extends EA_Controller {
|
||||||
$this->appointments_model->only($appointment, $fields);
|
$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)
|
if ( ! $appointment)
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Categories_api_v1 extends EA_Controller {
|
||||||
|
|
||||||
$fields = $this->api->request_fields();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$service_categories = empty($keyword)
|
$service_categories = empty($keyword)
|
||||||
? $this->service_categories_model->get(NULL, $limit, $offset, $order_by)
|
? $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);
|
$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();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$service_category = $this->service_categories_model->find($id);
|
$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);
|
$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)
|
if ( ! $service_category)
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Customers_api_v1 extends EA_Controller {
|
||||||
|
|
||||||
$fields = $this->api->request_fields();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$customers = empty($keyword)
|
$customers = empty($keyword)
|
||||||
? $this->customers_model->get(NULL, $limit, $offset, $order_by)
|
? $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);
|
$this->customers_model->only($customer, $fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty($attach))
|
if ( ! empty($with))
|
||||||
{
|
{
|
||||||
$this->customers_model->attach($customer, $attach);
|
$this->customers_model->load($customer, $with);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Providers_api_v1 extends EA_Controller {
|
||||||
|
|
||||||
$fields = $this->api->request_fields();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$providers = empty($keyword)
|
$providers = empty($keyword)
|
||||||
? $this->providers_model->get(NULL, $limit, $offset, $order_by)
|
? $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);
|
$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();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$provider = $this->providers_model->find($id);
|
$provider = $this->providers_model->find($id);
|
||||||
|
|
||||||
|
@ -103,9 +103,9 @@ class Providers_api_v1 extends EA_Controller {
|
||||||
$this->providers_model->only($provider, $fields);
|
$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)
|
if ( ! $provider)
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Secretaries_api_v1 extends EA_Controller {
|
||||||
|
|
||||||
$fields = $this->api->request_fields();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$secretaries = empty($keyword)
|
$secretaries = empty($keyword)
|
||||||
? $this->secretaries_model->get(NULL, $limit, $offset, $order_by)
|
? $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);
|
$this->secretaries_model->only($secretary, $fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty($attach))
|
if ( ! empty($with))
|
||||||
{
|
{
|
||||||
$this->secretaries_model->attach($secretary, $attach);
|
$this->secretaries_model->load($secretary, $with);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Services_api_v1 extends EA_Controller {
|
||||||
|
|
||||||
$fields = $this->api->request_fields();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$services = empty($keyword)
|
$services = empty($keyword)
|
||||||
? $this->services_model->get(NULL, $limit, $offset, $order_by)
|
? $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);
|
$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();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$service = $this->services_model->find($id);
|
$service = $this->services_model->find($id);
|
||||||
|
|
||||||
|
@ -103,9 +103,9 @@ class Services_api_v1 extends EA_Controller {
|
||||||
$this->services_model->only($service, $fields);
|
$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)
|
if ( ! $service)
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Unavailabilities_api_v1 extends EA_Controller {
|
||||||
|
|
||||||
$fields = $this->api->request_fields();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$unavailabilities = empty($keyword)
|
$unavailabilities = empty($keyword)
|
||||||
? $this->unavailabilities_model->get(NULL, $limit, $offset, $order_by)
|
? $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);
|
$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();
|
$fields = $this->api->request_fields();
|
||||||
|
|
||||||
$attach = $this->api->request_attach();
|
$with = $this->api->request_with();
|
||||||
|
|
||||||
$unavailability = $this->unavailabilities_model->find($id);
|
$unavailability = $this->unavailabilities_model->find($id);
|
||||||
|
|
||||||
|
@ -103,9 +103,9 @@ class Unavailabilities_api_v1 extends EA_Controller {
|
||||||
$this->unavailabilities_model->only($unavailability, $fields);
|
$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)
|
if ( ! $unavailability)
|
||||||
|
|
|
@ -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
|
* @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 NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_map('trim', explode(',', $attach));
|
return array_map('trim', explode(',', $with));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue