CodeIgniter Forums
How make one route - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: How make one route (/showthread.php?tid=84935)



How make one route - motoroller - 11-24-2022

$routes->get('owner', [Calendar::class, 'Index']);
$routes->get('owner/calendar', [Calendar::class, 'Index']);


same touters how make one?


RE: How make one route - SubrataJ - 11-24-2022

We can not do this as of now, because in RouteCollection class get function's first params will accept a string, therefore we can't send a bunch of URI parts as an array.


RE: How make one route - iRedds - 11-24-2022

$routes->get('owner(?:\/calendar)?', [Calendar::class, 'Index']);


RE: How make one route - motoroller - 11-24-2022

(11-24-2022, 09:25 AM)iRedds Wrote: $routes->get('owner(?:\/calendar)?', [Calendar::class, 'Index']);

can i simplify? $routes->get('owner(/calendar)?', [Calendar::class, 'Index']);