I am facing a problem in my application. Let there is two middleware 1)User 2)Admin Is it possible to get which middleware I authenticated in my controller? I am using Laravel 5.4. Here is my route declaration
Route::group(['prefix' => 'user'], function () {
Route::group(['middleware' => ['auth:api']], function () {
Route::post('shop/store', 'ApiShopController@shopStore');
Route::post('shop/update', 'ApiShopController@shopUpdate');
});
});
Route::group(['prefix' => 'admin'], function () {
Route::group(['middleware' => ['auth:admin-api']], function () {
Route::post('shop/store', 'ApiShopController@shopStore');
Route::post('shop/update', 'ApiShopController@shopUpdate');
});
});
Here is my midlleware declaration
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
'admin-api' => [
'driver' => 'token',
'provider' => 'admins',
],
]
auth:admin-apideclaration will override theauth:apideclaration! Using a different middleware for aapi/admin/shop/storeroute won't give you two paths, right?