Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #359 from zhwei/patch-1
Browse files Browse the repository at this point in the history
Remove a redundant fetch
  • Loading branch information
zofe authored Nov 15, 2016
2 parents 82f2c55 + d4b5822 commit d88af51
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/DataSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d88af51

Please sign in to comment.