eloquent-filemaker icon indicating copy to clipboard operation
eloquent-filemaker copied to clipboard

FM query builder not working something

Open Nilanjan011 opened this issue 3 years ago • 1 comments
trafficstars

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

Error showing: Undefined index: aggregate

also join() not working

Nilanjan011 avatar Nov 03 '22 06:11 Nilanjan011

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);

Smef avatar Nov 04 '22 18:11 Smef