How to convert to an array after using additional on a Laravel collection.
How to convert to an array after using additional on a Laravel collection. I'm not sure if this method is correct; since it doesn't seem to work even after sear
GGAMI·
How to convert to an array after using additional on a Laravel collection.
I'm not sure if this method is correct; since it doesn't seem to work even after searching,
maybe the method is a little wrong,
but I'll write it down for now.
In my case, I put the API response under result_data,
but it seems that this itself is actually wrong..
Just noting it down..
If you do this, $tt becomes an Array, and when you send it with sendResponse, it receives it properly and outputs the additional data_roles data as well.
Otherwise, there is a problem where the additional data is not output.
Anyway, when returning data from an API, it seems right to just output the collection directly..
I don't think it's right to output it in result_data..