Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FM query builder not working something #33

Open
Nilanjan011 opened this issue Nov 3, 2022 · 1 comment
Open

FM query builder not working something #33

Nilanjan011 opened this issue Nov 3, 2022 · 1 comment

Comments

@Nilanjan011
Copy link

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

Error showing:
Undefined index: aggregate

also join() not working

@Smef
Copy link
Member

Smef commented Nov 4, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants