public function getAll($uuid, Request $request)
    {
        $parentModel = static::$parentModel;
        $parentResource = $parentModel::findOrFail($uuid);

        // Authorize ability to view children models for parent
        $this->authorizeUserAction($this->parentAbilitiesRequired['view'], $parentResource);

        $model = static::$model;
        $resourceRelationName = model_relation_name($model);

        // Form model's with relations for parent query
        $withArray = [];
        foreach ($model::$localWith as $modelRelation) {
            $withArray[] = $resourceRelationName . '.' . $modelRelation;
        }

        $withArray = array_merge([$resourceRelationName], $withArray);

        $parentResource = $parentResource->where($parentResource->getKeyName(), '=', $parentResource->getKey())->with($withArray)->first();

        $collection = $parentResource->getRelationValue($resourceRelationName);

        if ($collection == null) {
            $collection = new Collection();
        }

        return $this->response->collection($collection, $this->getTransformer());
    }
public function getAll($uuid, Request $request)
    {
        $parentModel = static::$parentModel;
        $parentResource = $parentModel::findOrFail($uuid);

        // Authorize ability to view children models for parent
        $this->authorizeUserAction($this->parentAbilitiesRequired['view'], $parentResource);

        $model = static::$model;
        $resourceRelationName = model_relation_name($model);

        // Form model's with relations for parent query
        $withArray = [];
        foreach ($model::$localWith as $modelRelation) {
            $withArray[] = $resourceRelationName . '.' . $modelRelation;
        }

        $withArray = array_merge([$resourceRelationName], $withArray);

        $parentResource = $parentResource->where($parentResource->getKeyName(), '=', $parentResource->getKey())->with($withArray)->first();

        $collection = $parentResource->getRelationValue($resourceRelationName);

        if ($collection == null) {
            $collection = new Collection();
        }

        return $this->response->collection($collection, $this->getTransformer());
    }
public function getAll ( $ uuid , Request $ request ) { $ parentModel = static :: $ parentModel ; $ parentResource = $ parentModel :: findOrFail ( $ uuid ) ; // Authorize ability to view children models for parent $ this -> authorizeUserAction ( $ this -> parentAbilitiesRequired [ 'view' ] , $ parentResource ) ; $ model = static :: $ model ; $ resourceRelationName = model_relation_name ( $ model ) ; // Form model's with relations for parent query $ withArray = [ ] ; foreach ( $ model :: $ localWith as $ modelRelation ) { $ withArray [ ] = $ resourceRelationName . '.' . $ modelRelation ; } $ withArray = array_merge ( [ $ resourceRelationName ] , $ withArray ) ; $ parentResource = $ parentResource -> where ( $ parentResource -> getKeyName ( ) , '=' , $ parentResource -> getKey ( ) ) -> with ( $ withArray ) -> first ( ) ; $ collection = $ parentResource -> getRelationValue ( $ resourceRelationName ) ; if ( $ collection == null ) { $ collection = new Collection ( ) ; } return $ this -> response -> collection ( $ collection , $ this -> getTransformer ( ) ) ; }
Request to retrieve a collection of all items owned by the parent of this resource

@param string $uuid
@param Request $request
@return \Dingo\Api\Http\Response
Request to retrieve a collection of all items owned by the parent of this resource