i agree, they have changed the middleware's behavior since the last version. It does not behave as it did earlier.
your protected routes needs to have middleware 'web'. the easiest way to debug this is to check your protected routes have 'web' middleware.
try adding both web and auth middleware to the route group
That's not working. I tried adding:
Route::group(['middleware' => 'web', 'middleware' => 'auth'], function()
When I try to go to protected route, it just reloads the page.
And
Route::group(['middleware' => 'auth', 'middleware' => 'web'], function()
Same thing.
And tried leaving it as it was with just auth and wrapping all of my routes in a middleware web route group.
Same behavior as it previously had.
Routes does not go like that, if you want to add multiple middlewares you need to pass an array like this:
Route::group(['middleware' => ['web', 'auth']], function()
{
// all routes here will require the user to be logged in
});
Unfortunately, that didn't work either.
Does it matter where in web.php Auth::routes(); is?
It does not, but I did not clearly understand your problem, what's the main problem here?
I go to my website. Log in. That shows links to routes that require a user to be logged in. When I click one of those links, it takes me back to the login form.
Sure.
Route::get('/', array(
'as' => 'home',
'uses' => 'HomeController@getHome'
));
Route::get('watch/{id}', array(
'as' => 'home_watch_video',
'uses' => 'HomeController@getHomeWatch'
));
Route::get('search-results', array(
'as' => 'search_results',
'uses' => 'HomeController@getSearchResults'
));
foreach(File::allFiles(__DIR__.'/Routes/General') as $partial)
{
require_once $partial->getPathname();
}
Route::group(['middleware' => ['web', 'auth']], function()
{
Route::get('log-in/to', array(
'as' => 'log_in_to',
'uses' => 'HomeController@getAuthenticationForward'
));
foreach(File::allFiles(__DIR__.'/Routes/Admin') as $partial)
{
require_once $partial->getPathname();
}
foreach(File::allFiles(__DIR__.'/Routes/Admin/Shows') as $partial)
{
require_once $partial->getPathname();
}
foreach(File::allFiles(__DIR__.'/Routes/Admin/Productions') as $partial)
{
require_once $partial->getPathname();
}
foreach(File::allFiles(__DIR__.'/Routes/Admin/Recordings') as $partial)
{
require_once $partial->getPathname();
}
foreach(File::allFiles(__DIR__.'/Routes/Admin/Biographies') as $partial)
{
require_once $partial->getPathname();
}
foreach(File::allFiles(__DIR__.'/Routes/Admin/Venues') as $partial)
{
require_once $partial->getPathname();
}
});
Route::get('login/facebook', array(
'as' => 'facebook_login',
'uses' => 'Auth\LoginController@facebookRedirect'
));
Route::get('login/facebook/callback', array(
'as' => 'facebook_callback',
'uses' => 'Auth\LoginController@facebookCallback'
));
Auth::routes();
Route::get('/home', 'HomeController@index');
Not sure what's wrong, here's my last app using laravel 5.3
https://github.com/ConsoleTVs/Laralum/blob/master/routes/web.php
Thanks for trying, Console. I appreciate the help.
Does anyone else have a clue? I'm dead in the water using 5.3.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community