Currently, we are working on HRIS (Human Resource Information System). We have different user types such as Admin, HR, Employee. But that user types are not static. We want to have different route for each user type.
e.g.
https://website/admin/{controller}/{id}
The route will depend on the user who logged-in in the system. Will read its user type.
May we know if there's a way to configure the route for each user type?
The solution from my point of view would be:
You create a route (URL actually) that matches the pattern:
https://website/admin/3
that holds all the logic for this user - probably, invoking Model, asking for the respective user controller, e.g., superadmin and later on redirecting to...
Another URL matching
https://website/admin/superadmin/3
that now has both controller = superadmin
and variable id = 3
. It is not said, that the route should be different - you can implement the logic when the controller
is either a id
(integer) or string
to keep the logic more centralized.
Just to mention:
https://website/admin/3
should be fine - you can process the request from the respective Controller without redirecting (see 1. point)