samedi 8 août 2020

Laravel 5.1- Route Middleware doesn't work

Mİddleware doesnt work. Why? My code is at follow.

--> CheckSession.php middleware

 public function handle($request, Closure $next)
    {     
     if ($request->session()->has('email')){ return $next($request); }
     else{return redirect('/crm');}
    }  

--> routes.php

use App\Http\Middleware\CheckSession;

Route::get('testamacli', function () {
   return view('blank');    
})->middleware('session');

-->Kernel.php

 protected $routeMiddleware = [
        'session' => \App\Http\Middleware\CheckSession::class,
    ];


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire