protected function handleUnauthorizedRequest($request, $ability = null, $model = null)
    {
        if ($request->ajax()) {
            return response('Forbidden.', Response::HTTP_FORBIDDEN);
        }

        if (!$request->user()) {
            return redirect()->guest(config('laravel-authorize.login_url'));
        }

        throw new HttpException(Response::HTTP_UNAUTHORIZED, 'This action is unauthorized.');
    }