diff --git a/CHANGELOG b/CHANGELOG index de4c2f7..68ad3d2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/src/Apphp/DataGrid/Pagination.php b/src/Apphp/DataGrid/Pagination.php index 1038bc0..0cda942 100644 --- a/src/Apphp/DataGrid/Pagination.php +++ b/src/Apphp/DataGrid/Pagination.php @@ -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 @@ -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'); } }