[英]Multi auth for laravel 5.2 use middleware
I want to use multi authenticate in Laravel 5.2
. 我想在
Laravel 5.2
使用多重身份验证。 But I found a strange problem. 但是我发现了一个奇怪的问题。
Here is my code in route.php
. 这是我在
route.php
代码。
However I can not get $errors
in the login.blade.php
, it just returns null
. 但是我不能在
login.blade.php
得到$errors
,它只返回null
。
<?php
Route::group(['middleware' => ['web'], 'namespace' => 'Admin', 'prefix' => 'admin'], function () {
Route::auth();
});
?>
But when I remove the web middleware, it works. 但是,当我删除Web中间件时,它可以工作。
<?php
Route::group(`enter code here`['namespace' => 'Admin', 'prefix' => 'admin'], function () {
Route::auth();
});
?>
I don't know why. 我不知道为什么 My understanding is that when I want to use the session, I must use the web middleware.
我的理解是,当我要使用会话时,必须使用Web中间件。
Because on Laravel 5.2 the web
middleware is automatically applied, your routes in routes.php
are grouped with prefix App\\Http\\Controllers
and web
middleware. 因为Laravel 5.2的
web
中间件自动应用,你的路线routes.php
时可使用前缀组合App\\Http\\Controllers
和web
中间件。 You can find this definition on mapWebRoutes()
method of the RouteServiceProdiver.php
. 你可以找到关于这个定义
mapWebRoutes()
该方法RouteServiceProdiver.php
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.