I have a method in my Game model that retrieves a list of all games registered in a table on one database, iterates through every game found and fetches data from anoth
merge()
The merge method merges the given array into the original collection. If a string key in the given array matches a string key in the original collection, the given array's value will overwrite the value in the original collection
The only parameter to the method is the collection that should be merged. Here's an example.
get();
$b = Album::where('artist','Matt Nathanson')
->get();
$result = $a->merge($b);
$result->each(function($album)
{
echo $album->title.'
';
});
});
else
$array = array_merge($stats[$game->game]->toArray(), $map->toArray());
return Response::json($array);