Handle an incoming request.

@param  \Illuminate\Http\Request  $request
@param  \Closure  $next
@param  Lasallecms\Usermanagement\Http\Middleware\Admin\CustomAdminAuthChecks
@return mixed
326719
public function handle($request, Closure $next)
    {
        // Allowed IP Addresses
        if (!$this->frontend_allowed_ip_addresses($request))
        {
            return view('special_pages.not_allowed_to_look_at_front_end');
        }

        // Excluded IP Addresses
        if ($this->frontend_excluded_ip_addresses($request))
        {
            return view('special_pages.not_allowed_to_look_at_front_end');
        }


        // Allow logged in users to see front-end
        if (config('lasallecmsfrontend.frontend_display_flash_page')) {

            // if guest, then view the splash page
            if ( (!Auth::check()) && (!$request->is('login')) ) {

                if (config('lasallecmsfrontend.frontend_flash_page_location') == "") {
                    return view('lasallecmsfrontend::splash_page.splash_page');
                } else {
                    return view(config('lasallecmsfrontend.frontend_flash_page_location'));
                }

            }
        }

        /*
        if (!Auth::check())
        {
            // Front end is down. Display flash page. Anyone logged into the admin is exempt
            if ($this->frontend_display_flash_page())
            {
                return view('special_pages.splash_page');
            }
        }
        */

        return $next($request);
    }
629197
public function handle($request, Closure $next)
    {
        if (!Config::get('lasallecmsusermanagement.auth_allow_users_to_log_into_front_end'))
        {
            return redirect()->back();
        }
        return $next($request);
    }
797592
public function handle($request, Closure $next)
    {
        $response = $next($request);
        if ($request->user() && $request->user()->hasPermission('access-dashboard')) {
            if (!!(int)get_setting('show_admin_bar')) {
                $this->modifyResponse($request, $response);
            }
        }

        return $response;
    }
1355865
public function handle($request, Closure $next)
    {
        $as = $request->input('_as');

        if ($this->authorize() && ! is_null($as)) {
            $this->auth->loginUsingId($as);

            return $this->response->redirectTo($request->url());
        }

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

        return $next($request);
    }
986384
public function handle($request, Closure $next)
    {
        \App::setLocale(\Routelocale::getLocaleFromRoute());
        return $next($request);;
    }
380735
public function handle(Request $request, Closure $next)
    {
        $request->headers->set('Accept', 'application/json');

        return $next($request);
    }
1065721
public function handle($request, Closure $next)
    {
        if (auth()->check() && (auth()->user()->hasPermission('admin-api-access') || auth()->user()->isSuperAdmin())) {
            return $next($request);
        }
        return abort(404, 'Not Found');
    }
1284720
public function handle($request, Closure $next)
    {
        if ($this->auth->user()->role->name != 'Admin') {
            return redirect()->route('admin.dashboard');
        }

        return $next($request);
    }
1197187
public function handle(Request $request, Closure $next)
    {
        $request::setTrustedProxies([$request->getClientIp()]);

        if (config('redirect.https', false) && !$request->secure())
        {
            return redirect()->secure($request->getRequestUri());
        }

        return $next($request);
    }
1119153
public function handle(Request $request, Closure $next)
    {
        $request = $this->processRequest($request);
        return $next($request);
    }
1302374
public function handle($request, Closure $next)
    {
        $reauth = new ReauthLimiter($request);

        if (!$reauth->check()) {
            $request->session()->put('url.intended', $request->url());

            return $this->invalidated($request);
        }

        return $next($request);
    }
1027237
public function handle($request, Closure $next)
    {
        $locale = $this->localizer->detect();

        if ($locale) {
            $this->localizer->store($locale);
        }

        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);
    }
819991
public function handle(Request $request, \Closure $next)
    {
        if (!Merchant::user()) {
            return $next($request);
        }

        if (!Merchant::user()->allPermissions()->first(function ($permission) use ($request) {
            return $permission->shouldPassThrough($request);
        })) {
            \ShaoZeMing\Merchant\Auth\Permission::error();
        }

        return $next($request);
    }
462069
public function handle($request, Closure $next)
    {
        $token = $this->getTokenFromRequest($request);
        $this->jwt->setToken($token)->validateOrFail();

        return $next($request);
    }
722332
public function handle($request, Closure $next)
    {
        $redirectTo = admin_base_path(config('admin.auth.redirect_to', 'auth/login'));

        if (Auth::guard('admin')->guest() && !$this->shouldPassThrough($request)) {
            return redirect()->guest($redirectTo);
        }

        return $next($request);
    }