Reputation: 637
I need to create JSON Data from Laravel Collection. I have a collection that returns pictures records. I need to nest this collection which has multiple items into a higher key called photos and then convert into Json (toJson() function will be enough I believe)
This is my Collection result and I need to append this into a higher key called photos
Can anyone help me please? Regards!
Upvotes: 0
Views: 121
Reputation: 4684
Say you had a variable called $photos
.
dd(collect(['photos' => $photos]));
Upvotes: 1