protected function getMetaData($single = false)
    {
        if (!$single) {
            $meta = [
                "paging" => [
                    "links" => [

                    ]
                ]
            ];
            $limit = $this->parser->getLimit();
            $pageOffset = $this->parser->getOffset();

            $current = $pageOffset;

            // Remove offset because setting offset does not return
            // result. As, there is single result in count query,
            // and setting offset will not return that record
            $offset = $this->query->getQuery()->offset;

            $this->query->offset(0);

            $totalRecords = $this->query->count($this->table . "." . $this->primaryKey);

            $this->query->offset($offset);

            $meta["paging"]["total"] = $totalRecords;

            if (($current + $limit) < $meta["paging"]["total"]) {
                $meta["paging"]["links"]["next"] = $this->getNextLink();
            }

            if ($current >= $limit) {
                $meta["paging"]["links"]["previous"] = $this->getPreviousLink();
            }
        }

        $meta["time"] = round(microtime(true) - $this->processingStartTime, 3);

        if (env("APP_DEBUG") == true) {
            $log = \DB::getQueryLog();
            \DB::disableQueryLog();

            $meta["queries"] = count($log);
           $meta["queries_list"] = $log;
        }

        return $meta;
    }
protected function getMetaData($single = false)
    {
        if (!$single) {
            $meta = [
                "paging" => [
                    "links" => [

                    ]
                ]
            ];
            $limit = $this->parser->getLimit();
            $pageOffset = $this->parser->getOffset();

            $current = $pageOffset;

            // Remove offset because setting offset does not return
            // result. As, there is single result in count query,
            // and setting offset will not return that record
            $offset = $this->query->getQuery()->offset;

            $this->query->offset(0);

            $totalRecords = $this->query->count($this->table . "." . $this->primaryKey);

            $this->query->offset($offset);

            $meta["paging"]["total"] = $totalRecords;

            if (($current + $limit) < $meta["paging"]["total"]) {
                $meta["paging"]["links"]["next"] = $this->getNextLink();
            }

            if ($current >= $limit) {
                $meta["paging"]["links"]["previous"] = $this->getPreviousLink();
            }
        }

        $meta["time"] = round(microtime(true) - $this->processingStartTime, 3);

        if (env("APP_DEBUG") == true) {
            $log = \DB::getQueryLog();
            \DB::disableQueryLog();

            $meta["queries"] = count($log);
           $meta["queries_list"] = $log;
        }

        return $meta;
    }
protected function getMetaData ( $ single = false ) { if ( ! $ single ) { $ meta = [ "paging" => [ "links" => [ ] ] ] ; $ limit = $ this -> parser -> getLimit ( ) ; $ pageOffset = $ this -> parser -> getOffset ( ) ; $ current = $ pageOffset ; // Remove offset because setting offset does not return // result. As, there is single result in count query, // and setting offset will not return that record $ offset = $ this -> query -> getQuery ( ) -> offset ; $ this -> query -> offset ( 0 ) ; $ totalRecords = $ this -> query -> count ( $ this -> table . "." . $ this -> primaryKey ) ; $ this -> query -> offset ( $ offset ) ; $ meta [ "paging" ] [ "total" ] = $ totalRecords ; if ( ( $ current + $ limit ) < $ meta [ "paging" ] [ "total" ] ) { $ meta [ "paging" ] [ "links" ] [ "next" ] = $ this -> getNextLink ( ) ; } if ( $ current >= $ limit ) { $ meta [ "paging" ] [ "links" ] [ "previous" ] = $ this -> getPreviousLink ( ) ; } } $ meta [ "time" ] = round ( microtime ( true ) - $ this -> processingStartTime , 3 ) ; if ( env ( "APP_DEBUG" ) == true ) { $ log = \ DB :: getQueryLog ( ) ; \ DB :: disableQueryLog ( ) ; $ meta [ "queries" ] = count ( $ log ) ; $ meta [ "queries_list" ] = $ log ; } return $ meta ; }
Builds metadata - paging, links, time to complete request, etc

@return array
Builds metadata - paging links time to complete request etc