Controller with index($id) method with parameter |
Is it possible to have a Controller with the index() method that accepts a parameter?
e.g. controller called "Listjob" with method index($jobid) in such a way to allow this URL to work http://myapp.local/listjob/53 I have no custom routes set in app/Config/Routes.php and router setup is default PHP Code: $routes->setDefaultNamespace('App\Controllers'); The only way to make it work has been to abandon index($jobid) and just change its name from index to a different one , I used "show" but now as you may guess I have to browse to http://myapp.local/listjob/show/53 I also have tried to add a custom route PHP Code: $routes->add('listjob/(:any)', 'listjob/index/$1'); but again no success Thank you for nay hint regarding this |
Messages In This Thread |
Controller with index($id) method with parameter - by Corsari - 08-25-2021, 05:42 AM
RE: Controller with index($id) method with parameter - by captain-sensible - 08-25-2021, 06:56 AM
RE: Controller with index($id) method with parameter - by plaztic - 08-25-2021, 10:52 AM
RE: Controller with index($id) method with parameter - by Corsari - 08-25-2021, 01:06 PM
RE: Controller with index($id) method with parameter - by captain-sensible - 08-26-2021, 01:45 AM
|