group table rows by morph column
Hi, i have a price lines table with a parent morph table. A price line can be added to a Order or TransportOrder.
I would like to group the table by the unique combination of parent_type and parent_id but i can't get it to work...
I have tried modifying query and then calling the default group on the column with parent_unique:
I tried adding an attribute to the PriceLine model but i think the group by is executed as an sql query so the attribute does not work. It does load in the table of course but i cant group on it...
Also tried making a group column via the Group class:
I really want this grouping because this table will generate invoice lines and i want to use the bulk select to do this. Any help is appreciated!
Solution:
Jump to solution
You need both the titleFromRecord AND the groupQueryUsing. This does work. made an attribute on price line and now it groups correct.
```php
Group::make('parent_id')
->label('Parent')...

1 Reply
Solution
You need both the titleFromRecord AND the groupQueryUsing. This does work. made an attribute on price line and now it groups correct.
