lib/Http/Controllers/Base/ObjectController.php
protected function loadAuthorizeObject($id, $action)
    {
        $model = $this->getRepository()->findById($id, [], app('context'));
        if (empty($model)) {
            throw new NotFoundHttpException("Object ($id) not found");
        }
        if (!$model->isAllowed($action)) {
            throw new AccessDeniedHttpException("Forbidden");
        }
        return $model;
    }
protected function loadAuthorizeObject($id, $action)
    {
        $model = $this->getRepository()->findById($id, [], app('context'));
        if (empty($model)) {
            throw new NotFoundHttpException("Object ($id) not found");
        }
        if (!$model->isAllowed($action)) {
            throw new AccessDeniedHttpException("Forbidden");
        }
        return $model;
    }
protected function loadAuthorizeObject ( $ id , $ action ) { $ model = $ this -> getRepository ( ) -> findById ( $ id , [ ] , app ( 'context' ) ) ; if ( empty ( $ model ) ) { throw new NotFoundHttpException ( "Object ($id) not found" ) ; } if ( ! $ model -> isAllowed ( $ action ) ) { throw new AccessDeniedHttpException ( "Forbidden" ) ; } return $ model ; }
Get the object and check to make sure the authorized user has access
@param  string|int    $id
@param  string        $action Action to be taken (read, update, delete)
@throws NotFoundHttpException        Model could not be found
@throws AccessDeniedHttpException    User is not allowed to perform the action with this model
@return Model         Loaded model
Get the object and check to make sure the authorized user has access