SkyCoder
4 months ago

Laravel groupby multiple columns and merge

Posted 4 months ago by SkyCoder

Is there an function to merge data from groupby with more columns?

$data->->groupBy('day','skill')->get();

and for output currently I have:

[day1,skill1], [day1, skill2], [day1, skill3], [day2, skill1]

Is there way to get:

[day1, [skill1, skill2, skill3]], [day2, [skill1]]

Without looping throught?

Please sign in or create an account to participate in this conversation.