Answer the question
In order to leave comments, you need to log in
Set 2 roles to 1 path?
Tell me how can I use 2 roles for 1 path. I am using the Laravel Permission library. When installing mdlvar 1 on routes, when you try to call it again, it says that the role is not suitable.
Here is an example of a route list.
Route::group(['middleware'=>['role:user_сitisen']],function(){
Route::get('/addcitisens', [App\Http\Controllers\CitisenControl::class, 'index']);
Route::get('/citisen/{id}', [App\Http\Controllers\CitisenControl::class, 'show']);
Route::post('/citisen/{id}', [App\Http\Controllers\CitisenControl::class, 'update'])->name('citisen');
Route::get('/destroy/{id}', [App\Http\Controllers\CitisenControl::class, 'destroy']);
Route::post('/citisens', [App\Http\Controllers\CitisenControl::class, 'store']);
Route::get('/citisens/export', [App\Http\Controllers\CitisenControl::class, 'CitisenExport']);
});
Route::group(['middleware'=>['role:user_avto']],function(){
Route::get('/avtoslist', [App\Http\Controllers\AvtosController::class, 'index']);
Route::get('/addavtos', [App\Http\Controllers\AvtosController::class, 'indexAdd']);
Route::post('/avtos', [App\Http\Controllers\AvtosController::class, 'store']);
});
Route::group(['middleware'=>['role:admin']],function(){
Route::get('/addcitisens', [App\Http\Controllers\CitisenControl::class, 'index']);
Route::get('/citisen/{id}', [App\Http\Controllers\CitisenControl::class, 'show']);
Route::post('/citisen/{id}', [App\Http\Controllers\CitisenControl::class, 'update'])->name('citisen');
Route::get('/destroy/{id}', [App\Http\Controllers\CitisenControl::class, 'destroy']);
Route::post('/citisens', [App\Http\Controllers\CitisenControl::class, 'store']);
Route::get('/citisens/export', [App\Http\Controllers\CitisenControl::class, 'CitisenExport']);
Route::get('/avtoslist', [App\Http\Controllers\AvtosController::class, 'index']);
Route::get('/addavtos', [App\Http\Controllers\AvtosController::class, 'indexAdd']);
Route::post('/avtos', [App\Http\Controllers\AvtosController::class, 'store']);
Route::get('/usersList', [App\Http\Controllers\UsersController::class, 'index'])->name('usersList');
Route::get('/addusers', [App\Http\Controllers\UsersController::class, 'indexUser']);
Route::post('/users', [App\Http\Controllers\UsersController::class, 'store']);
Route::get('/users/{id}', [App\Http\Controllers\UsersController::class, 'show']);
Route::post('/users/{id}', [App\Http\Controllers\UsersController::class, 'update']);
Route::get('/destroyuser/{id}', [App\Http\Controllers\UsersController::class, 'destroy']);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question