<?php

namespace App\Http\Middleware;

use Illuminate\Support\Facades\Route;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cookie;

class EnsureAdminSession
{
    public function handle(Request $request, Closure $next)
    {
        if (!$request->session()->has('adminSession')) {
            return redirect()->to(route('login'));
        }
        return $next($request);

    }

}
