Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

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...

Last updated 2 years ago.
0

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
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ammine007 ammine007 Joined 1 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.