Handle an incoming request.

@param  \Illuminate\Http\Request $request
@param  \Closure $next
@return mixed
185657
public function handle($request, Closure $next, $guard = null)
    {
        try {
            $authinfo = \Besofty\Web\Attendance\Model\User::details(\Session::get('authinfo'));
            $roleID = \Besofty\Web\Attendance\Model\UsersRole::getRoleID($authinfo['id']);
            $userRole = \Besofty\Web\Attendance\Model\Role::getName($roleID['role_id']);
            $isAdmin = Role::isAdmin($userRole['slug']);

            if ($isAdmin['slug'] != 'super-administrator' && $isAdmin['slug'] != 'administrator' ) {
                return redirect('/logout');
            }
            return $next($request);
        } catch (\Exception $exception) {
            throw $exception;
        }
    }
1000337
public function handle($request, Closure $next)
    {
        // unBind {locale} route parameter
        ! $request->route('locale') || $request->route()->forgetParameter('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);
    }
305200
public function handle(Request $request, Closure $next)
    {
        $header = $request->header(self::AUTH_HEADER);
        $apiKey = ApiKey::getByKey($header);

        if ($apiKey instanceof ApiKey) {
            $this->logAccessEvent($request, $apiKey);
            return $next($request);
        }

        return response([
            'errors' => [[
                'message' => 'Unauthorized'
            ]]
        ], 401);
    }
1231658
public function handle($request, Closure $next)
    {
        $this->authorizer->setRequest($request);

        $this->authorizer->checkAuthCodeRequest();

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

        $this->setting->save();

        return $response;
    }
1224422
public function handle($request, Closure $next)
    {
        if ($this->auth->check()) {
            /** @var \Modules\User\Entities\User $user */
            $user = $this->auth->user();

            $user->last_active_at = $user->freshTimestamp();
            $user->saveWithoutTimestamps(); // don't update updated_at
        }

        return $next($request);
    }
204720
public function handle( $request, Closure $next )
    {
        if( $this->isAllowedIp( $request ) )
        {
            return $next( $request );
        }

        return abort( 403 );
    }
1082528
public function handle($request, Closure $next)
    {
        $this->aclPolicy->defineAbilities();

        if ( ! $this->aclPolicy->passesAuthorization() ) {
            abort(403, config('acl.unauthorized_message'));
        }

        return $next($request);
    }
890253
public function handle(Request $request, Closure $next)
    {
        if (!$this->service->isCorsRequest($request)) {
            return $next($request);
        }

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

        return $this->service->handleRequest($request, $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);
        }
    }
873539
public function handle(Request $request, \Closure $next)
	{
		$this->buildRepository($request);

		return $next($request);
	}
329398
public function handle($request, Closure $next)
    {
        try {
            $response = $next($request);
        } catch (Exception $e) {
            $response = $this->handleException($request, $e);
        }

        if ($this->sentMail() && $response instanceof Response) {
            $this->appendToResponse($response);
        }

        return $response;
    }
414210
public function handle($request, \Closure $next)
    {
        $token = $this->authenticate($request);
        $response = $next($request);

        if ($token) {
            $response->header('Authorization', 'Bearer ' . $token);
        }

        return $response;
    }
611914
public function handle($request, Closure $next)
    {
        $paginationKey = config('pagination.key');

        $request->offsetSet($paginationKey, $request->paginationCount());

        return $next($request);
    }
1301372
public function handle($request, Closure $next)
    {
        if ( ! $this->auth->check()) {

            if ($request->ajax() || $request->wantsJson()) {
                return response('Unauthorized.', 401);
            } else {
                /** @var CoreInterface $core */
                $core = app(Component::CORE);

                return redirect()->route( $core->prefixRoute(NamedRoute::AUTH_LOGIN) );
            }
        }

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