I have array structure like this:
[
{product:"A", user_id:1},
{product:"B", user_id:2},
{product:"C", user_id:1}
]
I want re-structure array by user_id like this:
[
{user_id:1, product:["A","C"]},
{user_id:2, product:["B"]}
]
How to change like that using php laravel, Thank you for your answer.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire