Skip to content

Commit

Permalink
Fixed error in argument validation in Pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
apphp committed Jan 3, 2021
1 parent 1cbc5fd commit 7fe0c05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 0.5.1 - Jan 3, 2021
----------------------------
- Fix: error in argument validation in Pagination


Version 0.5.0 - Jan 3, 2021
----------------------------
- New: added config file
Expand Down
6 changes: 3 additions & 3 deletions src/Apphp/DataGrid/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Illuminate\Pagination\LengthAwarePaginator;
use Jenssegers\Agent\Agent;
use Illuminate\Database\Eloquent\Relations\Relation;
use http\Exception\InvalidArgumentException;
use Illuminate\Database\Eloquent\Builder;


class Pagination
Expand Down Expand Up @@ -204,8 +204,8 @@ public static function renderLinks()
*/
protected static function guardIsRelationObject($query = null)
{
if ( ! ($query instanceof Relation)) {
throw new InvalidArgumentException('Wrong type of object: $query');
if ( ! ($query instanceof Relation || $query instanceof Builder )) {
throw new \InvalidArgumentException('Wrong type of object: $query');
}
}

Expand Down

0 comments on commit 7fe0c05

Please sign in to comment.