Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lukeboy_2002's avatar

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

0 likes
4 replies
lukeboy_2002's avatar

I checked the code, it's the same. I think i forgot something

Please or to participate in this conversation.