Skip to content

Commit

Permalink
Attempt to fix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
fadion committed Mar 2, 2015
1 parent 9d797d3 commit ab43fe8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 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\Support\Facades\Paginator;
use Illuminate\Pagination\Paginator;

class ElasticCollection extends Collection {

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

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

return Paginator::make($sliced, count($this->items), $perPage);
return new Paginator($sliced, $perPage);
}

/**
Expand Down Expand Up @@ -130,4 +130,4 @@ public function shards($key = null)
return $shards;
}

}
}

0 comments on commit ab43fe8

Please sign in to comment.