Support the ongoing development of Laravel.io →
posted 9 years ago
Eloquent
Last updated 1 year ago.
0

You could look at PHP's array_merge or array_combine (after you have converted the results to arrays) and then convert the output to a Collection if you needed it.

Or better still, I'd probably look at running a raw DB query to get the data you wanted. It sounds to me like the standard Eloquent result sets won't cut it in this case.

If someone else has a solution to merge collections, that might be better. I've not heard of one yet though.

Hope it helps.

Last updated 1 year ago.
0

you could try to use merger method. http://laravel.com/api/5.1/Illuminate/Database/Eloquent/Collec...

$collection_one->merger($collection_two)
0

Sign in to participate in this thread!

Eventy

Your banner here too?

divdax divdax Joined 3 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.