'Laravel 9 trying to access array offset on value of type int when save to database

my issue is when i do this --->

$response = Http::post('api', ['code' => $api['code']]);

        $datas = json_decode($response, true);
        foreach ($datas as $data)
        {
            $info = new Info();
            $info['country'] = $data['country'];
            $info['code'] = $data['code'];
            $info['confirmed'] = $data['confirmed'];
            $info['recovered'] = $data['recovered'];
            $info['critical'] = $data['critical'];
            $info['deaths'] = $data['deaths'];
            $info->save();
        }
</code>

i get an error :: trying to access array offset on value of type int how can i fix this? i try to save this to database (this is come from post method) my tables of country and code has 'string' types and confirmed recovered and etc which is below is bigInteger types? whats an issue??



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source