Heh i am working from 2 days on this and can't do it :( I have two collections from eloquent
$store_local = Customer::all();
$store_remote = sCustomer::find($store_local->pluck('abc_id'));
In store local i have customers with abc_id which is in other database. Thats why i have to get all clients from other DB, as far as good
Now i would like merge both collections
$customer = $store_local->map(function ($item, $key) use($store_remote) {
$singleCustomer = $store_remote->where('id', $item->abc_id);
return collect($item)->merge($singleCustomer);
});
My result is
I have access to data from sCustomer
echo $customer[0][0]->id
How can i merge sCustomer and dd attributes from there to $store_local collection
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2m6A7E1
via IFTTT
Aucun commentaire:
Enregistrer un commentaire