<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

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


        if(session()->has('servlet') and session()->get('servlet') == '0'){
            return redirect('/servlet');
        }

        if(session()->has('GoogleOtp') and session()->get('GoogleOtp') == '0'){
            return redirect('/GoogleF2');
        }


        
        if(session()->has('hub') and session()->get('hub') == 'true'){
                    session()->forget('hub');
                    return redirect('/GoToHubCart');
                }

        return $next($request);
    }
}
