Skip to content

Commit 1b4dd08

Browse files
committed
Spatie/laravel-query-builder support for >= 3.0
1 parent 405779f commit 1b4dd08

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"laravel/framework": "^8.0|^9.0",
1717
"laravel/passport": "^10.1.0",
1818
"spatie/laravel-permission": "^3.2",
19-
"spatie/laravel-query-builder": "^2.3|^3.0||^4.0|^5.0",
19+
"spatie/laravel-query-builder": "^2.3|^3.0|^4.0|^5.0",
2020
"phpdocumentor/reflection-docblock": "^4.3|^5.0",
2121
"lcobucci/jwt": "^4.0",
2222
"league/oauth2-server": "^8.3.2"

src/Http/Controllers/ApiController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Cronqvist\Api\Exception\ApiAuthorizationException;
66
use Cronqvist\Api\Services\Auth\Utils;
77
use Cronqvist\Api\Services\Helpers\GuessForModel;
8+
use Cronqvist\Api\Services\QueryBuilder\QueryBuilder;
89
use Illuminate\Auth\Access\AuthorizationException;
910
use Illuminate\Auth\AuthenticationException;
1011
use Illuminate\Database\Eloquent\Builder;
@@ -95,7 +96,8 @@ protected function defaultIndex()
9596
{
9697
$this->authorizeMethod('index');
9798
$data = [];
98-
if(($builder = $this->getBuilder()) instanceof Builder) {
99+
$builder = $this->getBuilder();
100+
if($builder instanceof QueryBuilder || $builder instanceof Builder) {
99101
$data = $this->perPage > 0
100102
? $builder->paginate($this->getPerPage())
101103
: $builder->get();

0 commit comments

Comments
 (0)