marcreichel / igdb-laravel

Simplify the integration of the IGDB API into your Laravel app. Including IGDB webhook support.
https://marcreichel.dev/docs/igdb-laravel
MIT License
104 stars 22 forks source link

Call to a member function getUrl() on array #74

Closed Afcyy closed 1 year ago

Afcyy commented 1 year ago

When I try to use function getUrl() I get the error message Call to a member function getUrl() on array;

GamesController:

use MarcReichel\IGDBLaravel\Models\Game;

$games = Game::select(["*"])->with(['cover'])->get();
return GamesResource::collection($games);

GamesResource:

use MarcReichel\IGDBLaravel\Enums\Image\Size;

public function toArray(Request $request): array
    {
        return [
            'cover' => $this->cover->getUrl(Size::COVER_BIG),
        ];
    }
marcreichel commented 1 year ago

I will look into this 👍🏼 Sorry for the inconveniences.

marcreichel commented 1 year ago

@Afcyy Fixed with version 4.0.0. It's a major release, because the minimum PHP version is bumped to PHP 8.1.

Please update to that release and check again.