laravel-json-api / eloquent

Serialize Eloquent models to JSON API resources
MIT License
12 stars 15 forks source link

Fix getting available filter logic #22

Closed X-Coder264 closed 2 years ago

X-Coder264 commented 2 years ago

Closes https://github.com/laravel-json-api/laravel/issues/139

lindyhopchris commented 2 years ago

@X-Coder264 thanks for taking the time to do this, but having investigated this, the bug is actually in the WhereHas filter - when it creates the FilterApplicator it is passing the wrong schema to it.

I'll close this PR, push my fix and comment on the issue about how you can give the fix a go.

X-Coder264 commented 2 years ago

@lindyhopchris You can reuse my test, if it passes it means that the issue has been fixed. I'll retest your solution manually though just to be sure.

lindyhopchris commented 2 years ago

@X-Coder264 I used a slightly different test setup so that I could test that filters from the relationship worked too. I.e. pivot filters.