From d4b5822db9ed4f1e8a7fd14e7ee56e0b8575a5ed Mon Sep 17 00:00:00 2001 From: Zhang Wei Date: Tue, 13 Sep 2016 16:42:47 +0800 Subject: [PATCH] Remove a useless fetch --- src/DataSet.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/DataSet.php b/src/DataSet.php index d5c85736..f8bcc2d8 100644 --- a/src/DataSet.php +++ b/src/DataSet.php @@ -204,18 +204,19 @@ public function build() case "query": case "model": - $this->total_rows = $this->query->count(); //orderby if (isset($this->orderby)) { $this->query = $this->query->orderBy($this->orderby[0], $this->orderby[1]); } + //limit-offset if (isset($this->limit)){ - $this->paginator = $this->query->paginate($this->limit, ['*'], 'page'.$this->cid); $this->data = $this->paginator; + $this->total_rows = $this->paginator->total(); } else { $this->data = $this->query->get(); + $this->total_rows = count($this->data); } break;