I am currently a bit stuck with some data that my Vue component is sending to my Laravel Controller. The data is as follows:
array:2 [
0 => {#1246
+"id": 1
+"name": "Developer"
}
1 => {#1249
+"id": 2
+"name": "Ops Matrix Admin"
}
]
For example if I wanted to get the name or the id out of this as an object so that I can use it with eloquent. How would I go about doing this?
This is what my controller currently looks like.
public function editUserPermissions(Request $request, $id) {
foreach($request->all() as $key => $value) {
$decode = json_decode($value);
dd($decode);
}
}
When I do dd($request->all()); I get the following:
array:1 [
"body" => "[{"id":1,"name":"Developer"},{"id":3,"name":"Ops Matrix User"}]"
]