CodeIgniter Forums
Route Groups using array can't be done? - 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: Route Groups using array can't be done? (/showthread.php?tid=88783)



Route Groups using array can't be done? - cdsaenz - 11-06-2023

I'm trying to use route groups as below but it doesn't seem to work.
Any idea why? If it's a stupid mistake, help me out please, I'm blind after a long time checking this out. Thanks Big Grin
$types = ['tesoro','cajas'];
foreach ($types as $type) {
    $group = "records/{$type}";
    $routes->group($group,['filter' => 'authGuard:allusers,agencyset'],function($routes){ ....

PS: If I use "records/cajas" directly, without the foreach it'll work fine.


RE: Route Groups using array can't be done? - kenjis - 11-06-2023

Your code does not work.
Show entire code block if you want to get help.