Authentication 登录后无法在同一浏览器上访问前端
登录后,当我尝试转到WelcomeController@index页面它重定向我在管理主页(第四路线)。 我的路线定义Authentication 登录后无法在同一浏览器上访问前端,authentication,redirect,routes,laravel-5,Authentication,Redirect,Routes,Laravel 5,登录后,当我尝试转到WelcomeController@index页面它重定向我在管理主页(第四路线)。 我的路线定义 Route::get('admin' , 'Auth\AuthController@getLogin' ) ; Route::get('/', 'WelcomeController@index'); Route::resource('fdws','FdwController'); Route::get('/home', ['as' => 'home', 'uses' =
Route::get('admin' , 'Auth\AuthController@getLogin' ) ;
Route::get('/', 'WelcomeController@index');
Route::resource('fdws','FdwController');
Route::get('/home', ['as' => 'home', 'uses' => 'FdwController@index']);
我认为这将发生,因为middelware重新定向验证
public function handle($request, Closure $next)
{
if ($this->auth->check())
{
return new RedirectResponse(url('/home'));
}
return $next($request);
}
欢迎控制器还有一件事是用于前端无会话,在AuthController中定义
$redirectPath
,以便在登录后重定向所需位置
protected $redirectPath = '/';
对于注销后:
protected $redirectAfterLogout = '/auth/login';
在AuthController中定义
$redirectPath
,以便在登录后重定向所需位置
protected $redirectPath = '/';
对于注销后:
protected $redirectAfterLogout = '/auth/login';
您可以从WelcomeController的构造函数中删除以下行,然后就可以访问WelcomeController@index
$this->middleware('guest');
如描述中所述,WelcomeController默认配置为仅允许来宾
|--------------------------------------------------------------------------
| Welcome Controller
|--------------------------------------------------------------------------
|
| This controller renders the "marketing page" for the application and
| is configured to only allow guests. Like most of the other sample
| controllers, you are free to modify or remove it as you desire.
您可以从WelcomeController的构造函数中删除以下行,然后就可以访问WelcomeController@index
$this->middleware('guest');
如描述中所述,WelcomeController默认配置为仅允许来宾
|--------------------------------------------------------------------------
| Welcome Controller
|--------------------------------------------------------------------------
|
| This controller renders the "marketing page" for the application and
| is configured to only allow guests. Like most of the other sample
| controllers, you are free to modify or remove it as you desire.