Skip to content

Commit

Permalink
Fixed division by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
Nil Portugues Caldero committed Jun 13, 2016
1 parent 76a27f2 commit fc40d51
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ public function findAll(Pageable $pageable = null)
EloquentSorter::sort($query, $sort);
}

$pageSize = $pageable->pageSize();
$pageSize = ($pageSize>0) ? $pageSize : 1;

return new ResultPage(
$query->paginate($pageable->pageSize(), $columns, 'page', $pageable->pageNumber())->items(),
$query->paginate()->total(),
$pageable->pageNumber(),
ceil($query->paginate()->total() / $pageable->pageSize())
ceil($query->paginate()->total() / $pageSize)
);
}

Expand Down

0 comments on commit fc40d51

Please sign in to comment.