I have about 10 type of users role in laravel application, where e.g.
user_type_1 and user_type 4 are accessing url-1.
user_type_7, user_type_5 and user_type 4 are accessing url-2.
user_type_5, user_type_1, user_type_3 and user_type 6 are accessing url-3.
............................................
............................................
n number of combination of routes. url according to user type.
My route/web.php
file have about 1500 routes and currently not seperated as group using middleware. I have to restrict user for only urls that is authorized for that kind of user_type. Can you please suggest any better approach for doing this.
I had tried with making combination of url with middleware group like below, but after few work left this approach.
Route::group(['middleware' => ['middleware_user_type_1', 'middleware_user_type_2']], function () {
Route::get('url-1', 'XYZController@someMethod');
});
In this way request first goes to first middleware in array and if not valid user type then not try with second middleware.