I keep some laravel routes in the middleware auth group as:
Route::group(['middleware'=>'auth'],function(){
Route::controller('Activities', 'ActivitiesController');
Route::get('foo','FooController@getFoo');
.....
});
When I try to login to access these page, I am unable to login and url redirect to login page again and again. But If I use constructor as:
public function __construct()
{
$this->middleware('auth');
}
In those controllers It works perfectly. What is route group problem?
Route::group(['middleware'=>'auth'],function(){ Route::controller('activities', 'ActivitiesController'); });
then controller<?php namespace App\Http\Controllers; class ActivitiesController extends Controller { public function getIndex() { return 'you are in; } }
on attempt to visit /activities I was redirected to login page , and on success back to \activities with 'you are in'. What does your login process looks like? – Emeka Mbah