jiyis jiyis - 2 years ago 216
PHP Question

Multi auth for laravel 5.2 use middleware

I want to use multi authenticate in

Laravel 5.2
. But I found a strange problem.

Here is my code in

However I can not get
in the
, it just return null.

Route::group(['middleware' => ['web'], 'namespace' => 'Admin', 'prefix' => 'admin'], function () {

But when I remove the web middleware, it works.

Route::group(`enter code here`['namespace' => 'Admin', 'prefix' => 'admin'], function () {

I don't know why. My understanding is that when I want to use the session, I must use the web middleware.

Can somebody help me?I would appreciate you. Thank you.

Answer Source

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. You can find this definition on mapWebRoutes() method of the RouteServiceProdiver.php.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download