I want to create a dynamic route in web.php
file. I don't know if it is a bad idea or not, and also I don't know if it is possible.
So my tables are role
, menu
, role_menu
role : id, role_name
menu : id, title, route
role_menu : role_id, menu_id
I have tried like this: Laravel : Setting dynamic routes based on access control list
okay, i will explain, but it's complicated...
so, i have a feature add role
, but just role admin can access it.
here's my add role
feature:
let's say i will input
student
and cheklist [client, banner, galery]
.
and when i login as student now, and i hit mayApp/tool
(which is not allowed for student) it can access it, that's the problem.
here's my web.php
:
Route::group(['middleware' => 'operator'], function() {
Route::resource('/list_of_menu', 'ListOfMenuController');
});
so the thing is, in the operatorMiddleware i want allowed the route only the access menu that have been checked. but i no have idea how to do it in operatorMIddleware.
if this still confusing, tell me...