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.');
    }
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.');
    }
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.' ) ; }
Handle the unauthorized request.

@param $request
@param string|null                              $ability
@param \Illuminate\Database\Eloquent\Model|null $model

@throws \Symfony\Component\HttpKernel\Exception\HttpException

@return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\RedirectResponse|Response
Handle the unauthorized request .