public function getChilds($id, $relation, $filters = null)
    {
        $parent = $this->model->find($id);
        
        if (! $parent) {
            return null;
        }
        
        if (count($filters->request->all()) > 0) {
            $child = $parent->$relation()->getRelated();
            
            $search = new Search($child, $filters, $parent->$relation());
            $this->builder = $search->getBuilder();
            
            /* Retorna os dados apenas da table/resource atual */
            $this->builder->select("{$child->getTable()}.*");
            
            return $this->builder->get();
        }
        
        $resource = $parent->$relation;
        
        return $resource;
    }
public function getChilds($id, $relation, $filters = null)
    {
        $parent = $this->model->find($id);
        
        if (! $parent) {
            return null;
        }
        
        if (count($filters->request->all()) > 0) {
            $child = $parent->$relation()->getRelated();
            
            $search = new Search($child, $filters, $parent->$relation());
            $this->builder = $search->getBuilder();
            
            /* Retorna os dados apenas da table/resource atual */
            $this->builder->select("{$child->getTable()}.*");
            
            return $this->builder->get();
        }
        
        $resource = $parent->$relation;
        
        return $resource;
    }
public function getChilds ( $ id , $ relation , $ filters = null ) { $ parent = $ this -> model -> find ( $ id ) ; if ( ! $ parent ) { return null ; } if ( count ( $ filters -> request -> all ( ) ) > 0 ) { $ child = $ parent -> $ relation ( ) -> getRelated ( ) ; $ search = new Search ( $ child , $ filters , $ parent -> $ relation ( ) ) ; $ this -> builder = $ search -> getBuilder ( ) ; /* Retorna os dados apenas da table/resource atual */ $ this -> builder -> select ( "{$child->getTable()}.*" ) ; return $ this -> builder -> get ( ) ; } $ resource = $ parent -> $ relation ; return $ resource ; }
Return all childs from relation

@return \Illuminate\Database\Eloquent\Model;
Return all childs from relation