I have a question a bit silly, the question is that I am ready to create the filter by roles in Laravel, I have created a middleware for the filter of roles in the routes and up to here everything OK.
The problem comes when I want to make this filter
Route::group(['middleware' => ['auth', 'roles'],'roles' => ['cliente','cliente_tipo2'],'prefix' => 'descargas'], function () {
// Index
Route::get('/', 'DescargasController@indexView')->name('indexDescargas');
Route::group(['middleware' => ['auth', 'roles'],'roles' => ['cliente_tipo2'],'prefix' => 'privado'], function () {
Route::get('/', 'DescargasController@privadoView')->name('indexDescargasprivado');
});
});
The question is that to enter the root of the first / within the first group, control those two roles OK (does not let others in), the problem arises in the second group, which instead of allowing only the role "client_type2" allows all of the above group (in this case "client" and "client_type2") to pass, despite being in another group with other middleware.
Any suggestions?