Skip to content

Commit

Permalink
Fixed paginate method in query to use length aware paginator class
Browse files Browse the repository at this point in the history
  • Loading branch information
dmyers committed May 22, 2016
1 parent f9e9e00 commit 92bc9ae
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Mmanos/Search/Query.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php namespace Mmanos\Search;

use App, Input;
use Illuminate\Pagination\LengthAwarePaginator;

class Query
{
Expand Down Expand Up @@ -220,17 +221,15 @@ public function delete()
*
* @param int $num
*
* @return \Illuminate\Pagination\Paginator
* @return \Illuminate\Pagination\LengthAwarePaginator
*/
public function paginate($num = 15)
{
$paginator = App::make('paginator');

$page = (int) Input::get('page', 1);

$this->limit($num, ($page - 1) * $num);

return $paginator->make($this->get(), $this->count(), $num);
return new LengthAwarePaginator($this->get(), $this->count(), $num, $page);
}

/**
Expand Down

0 comments on commit 92bc9ae

Please sign in to comment.