I can't see anything wrong with that code. I just tried on my data, and it works :/
What does the $vignettes return before "add" function.
Update
Nope, not working, when trying to iterate through new collection...
Eloquent\Collection is supposed to work with Eloquent Models, that's why it will cause errors.
You can use base Collection for this or first create a Model and only then add it to the Collection:
$vignettes = $vignettes->toBase();
$vignettes->push([ ... ]); // add is Eloquent Collection method, so use push instead
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.