Skip to content

Commit

Permalink
Update ElasticCollection.php
Browse files Browse the repository at this point in the history
  • Loading branch information
honarkhah authored Jul 20, 2016
1 parent 05ffec3 commit 16f3043
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Fadion/Bouncy/ElasticCollection.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php namespace Fadion\Bouncy;

use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\Paginator;
use Illuminate\Pagination\LengthAwarePaginator as Paginator;

class ElasticCollection extends Collection {

Expand All @@ -28,12 +28,12 @@ public function __construct($response, $instance)
*/
public function paginate($perPage = 15)
{
$paginator = new Paginator($this->items, $perPage);
$paginator = new Paginator($this->items, $this->total(), $perPage);

$start = ($paginator->currentPage() - 1) * $perPage;
$sliced = array_slice($this->items, $start, $perPage);

return new Paginator($sliced, $perPage);
return new Paginator($sliced, $this->total(), $perPage);
}

/**
Expand Down

0 comments on commit 16f3043

Please sign in to comment.