New to Laravel 5 and it's Middleware. Used Laravel 4 for around 3 years, but haven't touched it in around 6 months.
I've got a new Laravel 5 project which I'm following Jeffrey's Laravel 5 for Beginners Series.
Unfortunately I reached the end of his series so far and I wanted to keep going, lol. So I persisted, using the knowledge I have and the Documentation to include some form of Auth and Social Auth into the current project, so that I can associate Notes and Cards with users - as i'm sure he'll cover in his videos. Just impatient.
Sorry for the rambling preamble..
The problem is that on my / route, and any routes defined within my middleware => web route, I'm able to authenticate, and then see that I am authenticated with Auth::check().
However, upon trying to access a middleware => auth group, as suggested that I should do so from the Documentation, I am simply redirected back to the page I was initially on.
My Routes code is here:
Routes:
// Cards and Notes only for Authenticated Users.
Route::group(['middleware' => 'auth'], function() {
Route::get('cards', 'CardsController@index');
Route::get('cards/{card}', 'CardsController@show');
Route::post('cards/{card}/notes', 'NotesController@store');
Route::get('notes/{note}/edit', 'NotesController@edit');
Route::patch('notes/{note}', 'NotesController@update');
});
// Social Auth
Route::group(['middleware' => 'web'], function() {
Route::get('/', 'PagesController@home');
Route::get('about', 'PagesController@about');
Route::auth();
Route::get('social/{provider?}', 'Auth\AuthController@redirectToProvider');
Route::get('social/{provider?}/callback', 'Auth\AuthController@handleProviderCallback');
});
AuthController is pretty much stock, with Socialite added in, and I haven't touched the Kernel.php file or any Middleware files for fear of breaking anything.
I read in another post that ['middleware' => 'web','auth'] would fix it - but that created a redirect loop on all pages..
I also have it in a GitHub repo, if that's of any help? https://github.com/MadMikeyB/l5project