Handle an incoming request.

@param  \Illuminate\Http\Request  $request
@param  \Closure  $next
@return mixed
178929
public function handle($request, Closure $next)
    {
        if(hst_config('safe', 'manage.request')) {
            $RequestLogDir = base_path('storage/hstcms/requestlog/'. hst_time2str(hst_time(), 'Ym') . '/');
            $file = $RequestLogDir . hst_time2str(hst_time(), 'd') . '.log';
            $files = new Filesystem();
            if (!$files->isDirectory($RequestLogDir)) {
                $files->makeDirectory($RequestLogDir, 0755, true);
            }
            $data = [
                'method'=> $request->method(),
                'uri'=> $request->path(),
                'url'=> url()->current(),
                'times'=> hst_time(),
                'ip'=> hst_ip(),
                'port'=> hst_port(),
                'platform'=> hst_agent()->platform(),
                'browser'=> hst_agent()->browser(),
                'data'=> $request->all(),
                'username'=> 'admin'
            ];
            $log = is_file($file) ? @explode(PHP_EOL, file_get_contents($file)) : array();
            if ($log) {
                $end = empty(end($log)) ? unserialize(end($log)) : array();
                if ($end
                    && $end['method'] === $request->method()
                    && $end['uri'] === $request->path()
                    && $data['username'] === $end['username']
                    && ($data['times'] - $end['times']) < 1) {
                    unset($data);// 1s内的重复操作不记录
                }
            }
            if (isset($data)) {
                $_phpeol = $log ? PHP_EOL:"";
                file_put_contents($file, $_phpeol . serialize($data), FILE_APPEND);
            }
            unset($data, $RequestLogDir, $file, $log, $end);
        }
        return $next($request);
    }
972179
public function handle($request, Closure $next)
    {
        if ($request->filled('_data')) {
            $data = json_decode($request->get('_data'), true);
            $request->merge($data);
            $request->offsetUnset('_data');
        }

        return $next($request);
    }
929465
public function handle($request, Closure $next)
    {
        Paginator::currentPageResolver(function () {
            return app('paginateroute')->currentPage();
        });

        return $next($request);
    }
690363
public function handle($request, Closure $next)
    {
        if (Auth::check() && Auth::user()->hasRole("Admin")) {
        return $next($request);
        }
        return redirect('login');
        // return Redirect::back();

    }
1163039
public function handle($request, Closure $next)
    {
        $guards = array_slice(func_get_args(), 2);

        $this->authenticate($guards);

        return $next($request);
    }
362388
public function handle($request, Closure $next)
    {
        if ($this->auth->check() && $this->auth->user()->hasAccess($this->routeActive)) {
            return $next($request);
        } else {
            abort(404);
        }
    }
13049
public function handle(Request $request, Closure $next)
    {
        $response = $this->router->routePage($request->route()->parameter('location'));

        if ($response) {
            return $response;
        }

        return $next($request);
    }
873539
public function handle(Request $request, \Closure $next)
	{
		$this->buildRepository($request);

		return $next($request);
	}
1306936
public function handle($request, Closure $next)
    {
        if ($this->auth->parser()->setRequest($request)->hasToken()) {
            try {
                $this->auth->parseToken()->authenticate();
            } catch (Exception $e) {
                //
            }
        }

        return $next($request);
    }
1135625
public function handle($request, Closure $next)
    {
        if (! $this->auth->user()->managesUsers()) {
            return response('Unauthorized.', 401);
        }

        return $next($request);
    }
1254984
public function handle($request, Closure $next)
    {
        if ($this->auth->check() && $this->auth->viaRemember()) {
            $ip = $request->getClientIp();

            $this->updateFields($this->auth, $ip);
        }

        return $next($request);
    }
709275
public function handle($request, Closure $next)
    {
        $this->tracker->trackRequest($request);

        return $next($request);
    }
987842
public function handle(Request $request, Closure $next)
    {
        $request::setTrustedProxies([], $this->getTrustedHeaderNames()); // Reset trusted proxies between requests
        $this->setTrustedProxyIpAddresses($request);

        return $next($request);
    }
1092459
public function handle($request, Closure $next)
    {
        $locale = $request->segment(1);

        $language = Language::findByCode($locale);

        if ($language) {
            App::setLocale($language->code);
            $request->setDefaultLocale($language->code);
        } else {
            $request->setDefaultLocale(config('app.locale'));
        }

        return $next($request);
    }
224119
public function handle($request, \Closure $next)
    {
        if ($request->expectsJson()) {
            return $next($request);
        }

        return json_response()->error([
            'message' => 'Invalid AJAX Request',
        ], $this->code);
    }
729059
public function handle($request, Closure $next)
    {
        $acceptLanguage = $request->header('Accept-Language');
        $locale = $this->getLocale($acceptLanguage);
        \App::setLocale($locale);
        return $next($request);
    }
888282
public function handle($request, Closure $next)
    {
        if ($class = AdminManager::getAdminInstance()) {
            $class = get_class($class);
        }

        if (!$this->permissions->check($class)) {
            return $this->permissions->denied($class);
        }

        return $next($request);
    }