Closed Jaspur closed 2 years ago
Hmm can you give me some more details? Maybe your model setup and what you're calling to generate this error? Thanks!
HI @aarondfrancis,
I think I found out what the issue is.
Your package need ::query()
to be added to the calls for fastPaginate()
.
But when I do with Scout, I get this:
Call to undefined method Illuminate\Database\Eloquent\Builder::search()
if (request()->has('search')) {
return new UserCollection(
User::search(request()->search)
// ->query() // not working with Scout
// ->fastPaginate() // does not work with scout, probably because of missing "query()"
->paginate() // this works, but I prefer fastPaginate of course ;-)
);
}
return new UserCollection(
User::query()->fastPaginate()
);
Probably Scout doesn't work when using ::query()
and fastPaginate()
doesn't work without it?
Yeah I only add the macro to the Eloquent builder and Relation class, and since Scout is using its own builder the method isn't there. I could probably add it, or at least let it fall through to the regular paginate
so you don't get errors. Let me try some stuff!
Added support for Scout, cutting a new release now! All it does is defer to the underlying implementation, but it no longer errors out.
Whoo, great! Thanks