CodeIgniter Forums
merge empty placeholders in routing - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: merge empty placeholders in routing (/showthread.php?tid=76371)



merge empty placeholders in routing - elserra - 05-06-2020

Is it possible to merge routes with and without placeholders? If the placeholder is empty, the Method gets called with $1 = null (or any other placeholders)
PHP Code:
$routes->post('save', 'BlogController::SavePost');

$routes->post('save/(:any)''BlogController::SavePost/$1'); 
The first one could be removed.