-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module Route with middleware auth not works #36
Comments
I have no idea if the
|
I am also not able to get value from Auth::user() in modules controller. can you please help me out. Route::group(['module' => 'ScreenColors', 'middleware' => ['web', 'auth'], 'namespace' => 'App\Modules\ScreenColors\Controllers'], function() { when i try to get Auth::user() it give me blank. |
please make sure, you have not defined this route somewhere else without the middleware. I think i should remove the resourceful api route from the generator. |
I have not define route any where, my route in module/screencolors/route/web.php Route::resource('screen_colors', 'ScreenColorsController'); |
could you post the api route of your screen_colors module? |
closing due to inactivity |
Hello, first of all thank you for your works!
I'm using your module, but i think to have find a problem. Default routes of module (web.php) is:
If i would like to protect my routes by middleware, i should change Route::group like that:
If i change Route::group like example above when i try to go to "/test", i will be redirect to "/". My suspicion is that auth middleware are not loaded in right way inside module, maybe for different namespace?
The only way i finded to workaround, is to edit routes.php of project (not of module!) adding inside Route::group(['middleware' => ['auth']], function() {
[...]
Route::get('/test', '\App\Modules\Test\Controllers\TestController@testIndex');
[...]This is no a really useful way to solve the problem. What i can do to solve that problem in web.php of module, istead of edit main Route file?
Best Regards,
Simone
The text was updated successfully, but these errors were encountered: