0

How can I make following query in lighthouse eloquent query?

select * from mytable group by customer

GrahamTheDev
  • 22,724
  • 2
  • 32
  • 64
oxygen
  • 151
  • 2
  • 3
  • 14
  • 2
    Just so you know the "lighthouse" tag is for Google Lighthouse (performance testing software) so I removed it from your questions to avoid confusion. – GrahamTheDev Jun 26 '21 at 09:34

2 Answers2

1

There is no a directive for that. You can use just the @field directive and there you can put anything you want. Or maybe adding some scopes. I mean, think in terms of Eloquent, more than plain queries.

Enzo Notario
  • 639
  • 4
  • 9
  • There are directives like whereCondition and orderBy. Why there is no directive like groupBy.. Anyway, thanks.. I think it is better to create a custom directive for grouping – oxygen Jun 26 '21 at 11:53
  • 1
    Well, you can always make a PR to add it. Just propose your idea and they will take in mind for sure! – Enzo Notario Jun 26 '21 at 22:57
1

You can either create your own directive, sth like @groupBy or just simply use a complex function through @field(resolver: ...) or @paginate(builder: ...) and do the grouping by using Laravel tools.

Alireza A2F
  • 519
  • 4
  • 26