How to route DooPHP URIs that include querystring?

132 Views Asked by At

I need to be able route requests that pass information in the querystring. For example, let's say my application calls /api/company/delete?id=17. How can I route that in DooPHP? I already have a catchall route defined, which is grabbing this request, but I need to be able to process these without a catchall route.

# this doesn't work
$route['get']['/api/company/delete?id=:id'] = array('AdminController', 'deletecompany');

# at the bottom of my routes I have this catchall route, which works but it catches --everything--
$route['*']['catchall']['/:id'] = array('HomeController', 'getregions'); 

Am I missing something obvious?

1

There are 1 best solutions below

0
On

routes $route['get']['/api/company/delete/:id'] = array('AdminController', 'deletecompany');

controller $this->params['id']

or

routes $route['post']['/api/company/delete'] = array('AdminController', 'deletecompany');

controller $_POST['id']