Skip to content

Commit 7fe0c05

Browse files
committed
Fixed error in argument validation in Pagination
1 parent 1cbc5fd commit 7fe0c05

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Version 0.5.1 - Jan 3, 2021
2+
----------------------------
3+
- Fix: error in argument validation in Pagination
4+
5+
16
Version 0.5.0 - Jan 3, 2021
27
----------------------------
38
- New: added config file

src/Apphp/DataGrid/Pagination.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use Illuminate\Pagination\LengthAwarePaginator;
2222
use Jenssegers\Agent\Agent;
2323
use Illuminate\Database\Eloquent\Relations\Relation;
24-
use http\Exception\InvalidArgumentException;
24+
use Illuminate\Database\Eloquent\Builder;
2525

2626

2727
class Pagination
@@ -204,8 +204,8 @@ public static function renderLinks()
204204
*/
205205
protected static function guardIsRelationObject($query = null)
206206
{
207-
if ( ! ($query instanceof Relation)) {
208-
throw new InvalidArgumentException('Wrong type of object: $query');
207+
if ( ! ($query instanceof Relation || $query instanceof Builder )) {
208+
throw new \InvalidArgumentException('Wrong type of object: $query');
209209
}
210210
}
211211

0 commit comments

Comments
 (0)