Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0
dd($sale->groups->toArray());

Does that result in an empty array too?

Last updated 1 year ago.
0

Yes, i have the good result. But i want to get all the objects "group", and with this code, i get only the attributes into an array...

Last updated 1 year ago.
0

Remove ->toArray() then.
The difference is basically ->groups() and ->groups. One is the collection/model, the other is the data. I think it's the data you want. Unfiltered, so no ->toJson() or ->toArray()

Last updated 1 year ago.
0

yes it works !

Thank you XoneFobic!

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

soclosed soclosed Joined 5 Feb 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.