<?php

namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Closure;
use Auth;
use Session;


class admincheckexiste
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle(Request $request, Closure $next)
    {
        // if(Auth::check()&&Auth::user()->user_type=='1'){
        //     return $next($request);            
        // }else{
        //    return redirect('admin');
        // }

        if(Session::get("admin") =='1'){
            return $next($request);            
        }else{
           return redirect('admin');
        }
    }
}
