I can get the array into a field in the page model, but after that, I’m stumped. I have tried to go through the array data using for and foreach, but I get an error about “Array to string conversion”. Using something like $page->roles()->toString() does the same thing where as $page->roles()->get() doesn’t return anything. Yup, I have been trying a lot of random stuff already
If I use dump($page->roles()), the contents is there, but how can I get the info out in plain “value1, value2, value3” format?
Hey, and welcome the forum. Must admit that I don’t quite understand. How did you assign the fields from the API to your page model? Could you please post the model?
A follow-up to this: there are e.g. address fields that are stored as arrays as well. Street address, post code and city are separate fields, also stored as arrays because one person can have several addresses in the source info.
I was going to make a for/foreach loop to go through the data in the fields, but is there a quicker or a more elegant way to do this?