protected function getResults($method)
    {
        if ($this->schema) {
            // set root constraints
            if (isset($this->constraints[$this->root])) {
                $this->constraints[$this->root]($this->eloquentQuery);
            }

            // set eager load constraints
            $this->eloquentQuery->setEagerLoads($this->parseRelationsFromSchema($this->schema, ''));

            // execute query
            $results = $this->eloquentQuery->$method();

            // transform to data transfer objects
            if ($results) {
                $dtos = $results->toDataTransferObject($this->root, $this->schema, $this->transformations);
                
                return [$this->root => $dtos];
            }
        }

        return null;
    }
protected function getResults($method)
    {
        if ($this->schema) {
            // set root constraints
            if (isset($this->constraints[$this->root])) {
                $this->constraints[$this->root]($this->eloquentQuery);
            }

            // set eager load constraints
            $this->eloquentQuery->setEagerLoads($this->parseRelationsFromSchema($this->schema, ''));

            // execute query
            $results = $this->eloquentQuery->$method();

            // transform to data transfer objects
            if ($results) {
                $dtos = $results->toDataTransferObject($this->root, $this->schema, $this->transformations);
                
                return [$this->root => $dtos];
            }
        }

        return null;
    }
protected function getResults ( $ method ) { if ( $ this -> schema ) { // set root constraints if ( isset ( $ this -> constraints [ $ this -> root ] ) ) { $ this -> constraints [ $ this -> root ] ( $ this -> eloquentQuery ) ; } // set eager load constraints $ this -> eloquentQuery -> setEagerLoads ( $ this -> parseRelationsFromSchema ( $ this -> schema , '' ) ) ; // execute query $ results = $ this -> eloquentQuery -> $ method ( ) ; // transform to data transfer objects if ( $ results ) { $ dtos = $ results -> toDataTransferObject ( $ this -> root , $ this -> schema , $ this -> transformations ) ; return [ $ this -> root => $ dtos ] ; } } return null ; }
Prepare query for execution.

@param string $method
@return array|null
Prepare query for execution .