Handle an incoming request.

@param \Illuminate\Http\Request $request
@param \Closure $next
@return mixed
556251
public function handle($request, Closure $next)
    {
        if (config('cache.enabled') === true) {
            $url = $request->url();

            $key = md5($url.json_encode($request->query()));
            $value = \Cache::remember($key, config('cache.minutes'), function() use ($next, $request) {
                return $next($request);
            });

            return $value;
        }

        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();

    }
558093
public function handle($request, Closure $next)
    {
        $response = $next($request);

        $this->setting->save();

        return $response;
    }
482879
public function handle($request, Closure $next)
    {
        if (auth()->guest() || !user()->hasRoles(['client', 'member'])) {
            return $next($request);
        }
        $this->beforeSendingThroughPipeline();
        $response = $next($request);
        $this->afterSendingThroughPipeline();

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

		return $next($request);
	}
729059
public function handle($request, Closure $next)
    {
        $acceptLanguage = $request->header('Accept-Language');
        $locale = $this->getLocale($acceptLanguage);
        \App::setLocale($locale);
        return $next($request);
    }
1138999
public function handle($request, Closure $next)
    {
        if (! $this->isCorsRequest($request)) {
            return $next($request);
        }

        $this->corsProfile->setRequest($request);

        if (! $this->corsProfile->isAllowed()) {
            return $this->forbiddenResponse();
        }

        if ($this->isPreflightRequest($request)) {
            return $this->handlePreflightRequest();
        }

        $response = $next($request);

        return $this->corsProfile->addCorsHeaders($response);
    }
776169
public function handle($request, Closure $next)
    {
        $route = $request->route();

        $this->router->substituteBindings($route);

        $this->substituteImplicitBindings($route);

        return $next($request);
    }
536806
public function handle($request, Closure $next)
    {
        $response = $next($request);

        if (! $response->headers->has('Etag')) {
            $response->setEtag(md5($response->getContent()));
        }

        $response->isNotModified($request);

        return $response;
    }
1196279
public function handle($request, Closure $next)
    {
        if ($request->method() != 'GET') {

            /** @var \Approached\LaravelImageOptimizer\ImageOptimizer $imageOptimizer */
            $imageOptimizer = app('Approached\LaravelImageOptimizer\ImageOptimizer');

            foreach ($request->allFiles() as $one) {
                if (is_array($one)) {
                    foreach ($one as $file) {
                        if ($this->isImageFile($file)) {
                            $imageOptimizer->optimizeUploadedImageFile($file);
                        }
                    }
                } else {
                    if ($this->isImageFile($one)) {
                        $imageOptimizer->optimizeUploadedImageFile($one);
                    }
                }
            }
        }

        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);
    }
464288
public function handle(Request $request, Closure $next)
    {
        // If the request URL is ignored from localization.
        if ($this->shouldIgnore($request)) return $next($request);

        $this->localization->setRouteNameFromRequest($request);

        return $next($request);
    }
552989
public function handle($request, Closure $next)
    {

        $request = $this->requestConverter->toCmsRequest($request);

        $request->provideCmsPath(function($request){
            $this->attachCmsPath($request);
        });

        $this->injectRequest($request);

        $this->app['events']->fire($this->requestEventName,[$request, $this]);

        return $next($request);

    }
234989
public function handle($request, Closure $next)
    {
        $response = $next($request);

        if (!in_array($response->getStatusCode(), config('maxfactor-support.enforceDomainsStatusCodes'))) {
            return $response;
        }

        return $this->validDomain($request, $response);
    }
78396
public function handle($request, Closure $next)
    {
        if (!Sentinel::check() || !Sentinel::inRole('admin')) {
            if ($request->ajax()) {
                return response('Unauthorized.', 401);
            } else {
                return Redirect::route('login');
            }
        }
        return $next($request);
    }
953052
public function handle($request, Closure $next)
    {
        $locale = \LocaleHelper::getLocale();
        app()->setLocale($locale);

        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);
    }