best practice - don't use multiple guards
Dec 1, 2025
4
Level 2
get user in multi guards same route
Hello, i have these routes
Route::group([
'prefix' => LaravelLocalization::setLocale(),
'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'localeViewPath']
],
function () {
Route::group([
'prefix' => 'shared',
'as' => 'shared.',
'middleware' => ['auth:admin,teacher'],
], function () {
Route::prefix('options')->name('options.')->group(function () {
Route::resource('', OptionController::class)->parameters(['' => 'option']);
});
});
});
when i loged in in the same browser it tow tabs one admin and the other teacher and
@dd(auth()->guard('admin')->check(), auth()->guard('teacher')->check())
the tow gives true
i want to get the options accordding to admin or teacher
Please or to participate in this conversation.