gearbox-solutions / eloquent-filemaker

A Model extension and Eloquent driver for Laravel connecting to FileMaker through the Data API
https://gearboxgo.com
MIT License
55 stars 16 forks source link

fix: override whereIn to work with FM #20

Closed phpsa closed 2 years ago

Smef commented 2 years ago

This will work for an independent "wherein", but if there are already existing wheres then the original where queries won't be applied to the wheres from the whereins which are being added, since they're being appended as an 'or'.

For example

Pet::where('flagged', true)->where('type', 'cat')->whereIn('fur_color', ['white', 'orange', 'black'])->get()

would make four find requests. The first would be 'flagged' and 'cat' and then there would be one additional find request per fur color. Instead, we should have three find requests with the flagged and type properties applied to each fur color.