Laravel Cannot use object of type stdClass as array with Job when iterating over data
I'm trying to loop over some data in one of my Laravel's job files. I'm successfully able to get my data, and can see it when I log it to a file, but for some strange reason when I try to iterate over my data with a foreach loop, I'm getting this error:
Cannot use object of type stdClass as array
public function handle()
{
$filters = json_decode($this->report->discovery_filters);
Log::debug($filters); // gives me my data which I'll attach
foreach ($filters as $key => $findable) {
Log::debug($findable['query']['table']); // errors
die;
}
}
My data:
[2021-03-10 14:11:57] local.DEBUG: array (
0 =>
(object) array(
'name' => 'Sessions',
'componentID' => 2435,
'query' =>
(object) array(
'table' => 'data_google_analytics'
// etc... too much data to attach the rest, but 'query' and then 'table' clearly exists