gearbox-solutions / eloquent-filemaker

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

FM query builder not working something #33

Closed Nilanjan011 closed 1 day ago

Nilanjan011 commented 1 year ago

$data = FM::table('table')->where('id',$id)->paginate(10);

Error showing: Undefined index: aggregate

also join() not working

Smef commented 1 year ago

I've reproduced this using the FM facade directly.

A few things I'm noticing with your example, though....

  1. If you're searching for an ID you should only be getting one record back. You shouldn't need to paginate something like that.

  2. I'd recommend using a model if possible rather than doing a query directly using the query builder if possible. You get more features than with the query builder, and paginating does work with models correctly.

As an alternative for your query, I'd recommend something like the following (pretending you're doing a query for the model "Person")

$pet = Person::find($id);

or if you really don't want to have a model for whatever reason...

$data = FM::table('table')->find($id);

likeadeckofcards commented 1 day ago

Closing this as stale