Level 18
First glance makes me thing you should map over your $allinstances variable, instead of Cart::content().
So you're making a collection of carts and putting them inside $allinstances;
$allinstances = collect([Cart::instance('default')->content(), Cart::instance('specials')->content()]);
But then you map over Cart::content(), where I think you should map over $allinstances.
Something like this:
$contents = $allinstances->map(function ($item) {
return $item->model->slug.', '.$item->qty;
})->values()->toJson();
I hope this helps.