src/Rest/CrudController.php
public function index($id = null)
    {
        // Support for resource/identifier/resource
        if ($id != null) {
            return $this->getById($id);
        }

        //parse the rquest
        $parse = new QueryParser($this->request->getQuery());
        $params = $parse->request();

        $results = $this->model->find($params);

        if ($this->request->hasQuery('relationships')) {
            $relationships = $this->request->getQuery('relationships', 'string');

            $results = QueryParser::parseRelationShips($relationships, $results);
        }

        //this means the want the response in a vuejs format
        if ($this->request->hasQuery('format')) {
            unset($params['limit'], $params['offset']);

            $results = [
                'data' => $results,
                'limit' => $this->request->getQuery('limit', 'int'),
                'page' => $this->request->getQuery('page', 'int'),
                'total_pages' => ceil($this->model->count($params) / $this->request->getQuery('limit', 'int')),
            ];
        }

        return $this->response($results);
    }
public function index($id = null)
    {
        // Support for resource/identifier/resource
        if ($id != null) {
            return $this->getById($id);
        }

        //parse the rquest
        $parse = new QueryParser($this->request->getQuery());
        $params = $parse->request();

        $results = $this->model->find($params);

        if ($this->request->hasQuery('relationships')) {
            $relationships = $this->request->getQuery('relationships', 'string');

            $results = QueryParser::parseRelationShips($relationships, $results);
        }

        //this means the want the response in a vuejs format
        if ($this->request->hasQuery('format')) {
            unset($params['limit'], $params['offset']);

            $results = [
                'data' => $results,
                'limit' => $this->request->getQuery('limit', 'int'),
                'page' => $this->request->getQuery('page', 'int'),
                'total_pages' => ceil($this->model->count($params) / $this->request->getQuery('limit', 'int')),
            ];
        }

        return $this->response($results);
    }
public function index ( $ id = null ) { // Support for resource/identifier/resource if ( $ id != null ) { return $ this -> getById ( $ id ) ; } //parse the rquest $ parse = new QueryParser ( $ this -> request -> getQuery ( ) ) ; $ params = $ parse -> request ( ) ; $ results = $ this -> model -> find ( $ params ) ; if ( $ this -> request -> hasQuery ( 'relationships' ) ) { $ relationships = $ this -> request -> getQuery ( 'relationships' , 'string' ) ; $ results = QueryParser :: parseRelationShips ( $ relationships , $ results ) ; } //this means the want the response in a vuejs format if ( $ this -> request -> hasQuery ( 'format' ) ) { unset ( $ params [ 'limit' ] , $ params [ 'offset' ] ) ; $ results = [ 'data' => $ results , 'limit' => $ this -> request -> getQuery ( 'limit' , 'int' ) , 'page' => $ this -> request -> getQuery ( 'page' , 'int' ) , 'total_pages' => ceil ( $ this -> model -> count ( $ params ) / $ this -> request -> getQuery ( 'limit' , 'int' ) ) , ] ; } return $ this -> response ( $ results ) ; }
List of business

@method GET
@url /v1/business

@todo  add security to query strings with bidn params
@return Phalcon\Http\Response
List of business