CodeIgniter Forums
merge empty placeholders in routing - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forum-29.html)
+--- Thread: merge empty placeholders in routing (/thread-76371.html)



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.