I'm trying to implode an array coming back from an axios call and I'm hitting an array to string conversion error.
When I hit the axios call, the payload shows the array like this:
categories: [{id: "1"},{id: "3"}]
then it comes into my PHP file where the function tries to implode:
public function implodeArray(array $categories=null){
$categoriesTest = empty($categories) ? '' : implode(','$categories);
}
but I'm hitting an array to string conversion error. If I dump the array right before implosion it's in this format:
array:2 [
0 => array:1 [
"id" => "1"
]
1 => array:1 [
"id" => "3"
]
]
I'm assuming it can't implode now because the indeces aren't comma separated?