<?php

namespace App\Http\Middleware;

//use Illuminate\Auth\Middleware\Authenticate as Middleware;

use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;

class VerifyBaseLab
{
    /**
     * Get the path the user should be redirected to when they are not authenticated.
     *
     * @param \Illuminate\Http\Request $request
     * @param Closure $next
     * @return string|null
     */

    public function handle(Request $request, Closure $next)
    {
        try{
            if (!$request->session()->exists('base_lab_id')) {
                return redirect('/base');
            }
        } catch (\Exception $e){

            Log::error($e);
        }
        return $next($request);
    }

}
