<?php

namespace App\Http\Middleware;

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

class Authenticate extends Middleware
{
    /**
     * Get the path the user should be redirected to when they are not authenticated.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return string
     */
    public  function  handle($request, Closure $next, ...$guards)
    {
        $request->session()->all();
        if($request->session()->has('lostring')==true){
            //return redirect('User/insert');
            //return redirect()->action("UserController@index_insert");
           //return parent::handle($request, $next, $guards); // TODO: Change the autogenerated stub
            return $next($request);
        }else{
            return redirect('/');
        }
    }
}
