I have a problem using middleware within a group that has middleware, such as the following code:
Route::group(['prefix' => '{lang?}','middleware'=>'language'], function() { Route::get('/', ' HomeController@index '); Route::get('/login',' AuthController@login '); Route::post('/login',' AuthController@do _login'); Route::get('/logout',' AuthController@logout '); Route::group(['prefix' => 'checkout','middleware'=>'authentication'], function () { Route::get('/', " CheckoutController@step1 "); }); });
And my current authentication is Middleware
<?php namespace App\Http\Middleware; use Closure; use Illuminate\Contracts\Routing\Middleware; use Session; use App; use Redirect; class AuthenticationMiddleware{ public function handle($request, Closure $next) { die("inside"); if(!User::check()) { return Redirect::to("/login"); } else { return $next($request); } } }
EDIT: Thus, it enters this last intermediate event when it is outside the scope of verification. How can i avoid this? Thank you all
source share