Level 75
May 16, 2021
4
Level 18
Cannot access offset of type string on string
I followed the series for laravel, build Build a Video Game Aggregator.
Now i have te error: Cannot access offset of type string on string. it is always in the function formatForView of the livewire component.
private function formatForView($games)
{
return collect($games)->map(function ($game) {
return collect($game)->merge([
'coverImageUrl' => Str::replaceFirst('thumb', 'cover_big', $game['cover']['url']),
'rating' => isset($game['rating']) ? round($game['rating']) : null,
'platforms' => collect($game['platforms'])->pluck('abbreviation')->implode(', '),
]);
})->toArray();
}
Did I forgot something? Or what am iI doing wrong
Please or to participate in this conversation.