I'm trying to use one uri in router but used different controller for some users role:
<?php
$routerGroup->addGet('example',function(){
$role = ?? //how can I get role from session from here
if('admin'==$role){
[
'controller'=>'example',
'action'=>'displayforadmin'
]
}
else{
[
'controller'=>'example',
'action'=>'displayforpublic'
]
}
});
- How can I use session from router like that ?
- How can I use condition controller used by $role value?
Thank You in advance..