vendredi 26 février 2016

a middleware to be run during every HTTP request to application except one in laravel 5.1

I am new in laravel , I want to create my app ( I dont want to use laravel default login system)

I want to use a middleware to be run during every HTTP request in my application except one

in laravel 5.1 documention syas I can use Global Middleware but I want to not use middleware for just login page. what should I do ? this is my middleware :

<?php

namespace App\Http\Middleware;

use Closure;

class Admin
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {

        if( !  session()->has('Login' )  )
        {
            return redirect('login');
        }

        return $next($request);
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire