Snippets
Laravel how to Merge Two Eloquent Collections?
If you want to merge two collections in Laravel eloquent, here is the easiest way to do that.
$users = User::all();
$profiles = Profile::all();
$usersAndProfiles = $users->merge($profiles);
It will return the combination of $users
and $profiles
data together.