Grouping by parent in a Select component
I have a 3 models -
Brief
, CustomOption
and CustomOptionType
. Each Brief
belongs to many CustomOptionType
with a pivot table -
And each CustomOptionType belongs to CustomOption -
Now, in BriefResource.php
- I'd like to group this Select component by the 'parents' of the custom option types -
I know you can group them when explicitly using the ->options()
function, but in this case im loading those directly via a relationship so im not sure how to achieve that.
Thanks in advance.4 Replies
you will need to override the options() etc to group them
yes, but in my case the options are being loaded automatically due to the ->relationship() function
i would guess you should generate options manually in this case