Use the new routes helper in the routes.php config file
This commit is contained in:
parent
308e41bbe1
commit
169b9818a6
1 changed files with 45 additions and 23 deletions
|
@ -39,46 +39,68 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$route['default_controller'] = 'appointments';
|
require_once __DIR__ . '/../helpers/routes_helper.php';
|
||||||
$route['404_override'] = 'errors/error404';
|
|
||||||
|
|
||||||
|
$route['default_controller'] = 'appointments';
|
||||||
|
|
||||||
|
$route['404_override'] = 'errors/error404';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------------
|
| -------------------------------------------------------------------------
|
||||||
| REST API ROUTING
|
| REST API ROUTING
|
||||||
| -------------------------------------------------------------------------
|
| -------------------------------------------------------------------------
|
||||||
| The following routes will point the API calls into the correct controller
|
| Define the API resource routes using the routing helper function. By
|
||||||
| callback methods. This routes also define the HTTP verbs that they are
|
| default, each resource will have by default the following actions:
|
||||||
| used for each operation.
|
|
|
||||||
|
| - index [GET]
|
||||||
|
|
|
||||||
|
| - show/:id [GET]
|
||||||
|
|
|
||||||
|
| - store [POST]
|
||||||
|
|
|
||||||
|
| - update [PUT]
|
||||||
|
|
|
||||||
|
| - destroy [DELETE]
|
||||||
|
|
|
||||||
|
| Some resources like the availabilities and the settings do not follow this
|
||||||
|
| pattern and are explicitly defined.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$resources = [
|
route_api_resource($route, 'appointments', 'api/v1/');
|
||||||
'appointments',
|
|
||||||
'unavailabilities',
|
|
||||||
'customers',
|
|
||||||
'services',
|
|
||||||
'categories',
|
|
||||||
'admins',
|
|
||||||
'providers',
|
|
||||||
'secretaries'
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($resources as $resource)
|
route_api_resource($route, 'admins', 'api/v1/');
|
||||||
{
|
|
||||||
$route['api/v1/' . $resource]['post'] = 'api/v1/' . $resource . '/post';
|
route_api_resource($route, 'categories', 'api/v1/');
|
||||||
$route['api/v1/' . $resource . '/(:num)']['put'] = 'api/v1/' . $resource . '/put/$1';
|
|
||||||
$route['api/v1/' . $resource . '/(:num)']['delete'] = 'api/v1/' . $resource . '/delete/$1';
|
route_api_resource($route, 'customers', 'api/v1/');
|
||||||
$route['api/v1/' . $resource]['get'] = 'api/v1/' . $resource . '/get';
|
|
||||||
$route['api/v1/' . $resource . '/(:num)']['get'] = 'api/v1/' . $resource . '/get/$1';
|
route_api_resource($route, 'providers', 'api/v1/');
|
||||||
}
|
|
||||||
|
route_api_resource($route, 'secretaries', 'api/v1/');
|
||||||
|
|
||||||
|
route_api_resource($route, 'services', 'api/v1/');
|
||||||
|
|
||||||
|
route_api_resource($route, 'unavailabilities', 'api/v1/');
|
||||||
|
|
||||||
$route['api/v1/settings']['get'] = 'api/v1/settings/get';
|
$route['api/v1/settings']['get'] = 'api/v1/settings/get';
|
||||||
|
|
||||||
$route['api/v1/settings/(:any)']['get'] = 'api/v1/settings/get/$1';
|
$route['api/v1/settings/(:any)']['get'] = 'api/v1/settings/get/$1';
|
||||||
|
|
||||||
$route['api/v1/settings/(:any)']['put'] = 'api/v1/settings/put/$1';
|
$route['api/v1/settings/(:any)']['put'] = 'api/v1/settings/put/$1';
|
||||||
|
|
||||||
$route['api/v1/settings/(:any)']['delete'] = 'api/v1/settings/delete/$1';
|
$route['api/v1/settings/(:any)']['delete'] = 'api/v1/settings/delete/$1';
|
||||||
|
|
||||||
$route['api/v1/availabilities']['get'] = 'api/v1/availabilities/get';
|
$route['api/v1/availabilities']['get'] = 'api/v1/availabilities/get';
|
||||||
|
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------------
|
||||||
|
| CUSTOM ROUTING
|
||||||
|
| -------------------------------------------------------------------------
|
||||||
|
| You can add custom routes to the following section to define URL patterns
|
||||||
|
| that are later mapped to the available controllers in the filesystem.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
/* End of file routes.php */
|
/* End of file routes.php */
|
||||||
/* Location: ./application/config/routes.php */
|
/* Location: ./application/config/routes.php */
|
||||||
|
|
Loading…
Reference in a new issue