This is my query:
$data=Auth::user()->roles()->with('permissions')->get()->pluck('permissions');
return $data;
The output of the query is as following:
[
[
{
id: 2,
name: "Read",
slug: "Read",
description: "This is Simple Read Permission",
pivot: {
role_id: 2,
permission_id: 2,
},
},
{
id: 3,
name: "Update",
slug: "Update",
description: "This is Simple Update Permission",
pivot: {
role_id: 2,
permission_id: 3,
},
},
]
]
Now I want to convert this into an array. I've already use the map()
and toArray()
function, but the result still remains the same format.
How can I convert this collection in to an array?