Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spatie Medialibrary incompatibility #521

Open
cv-chameleon opened this issue Jun 30, 2024 · 0 comments
Open

Spatie Medialibrary incompatibility #521

cv-chameleon opened this issue Jun 30, 2024 · 0 comments

Comments

@cv-chameleon
Copy link

cv-chameleon commented Jun 30, 2024

Due to the change in Spatie Medialibrary https://github.com/spatie/laravel-medialibrary/releases/tag/11.4.3 where the GetMediaModel function is added on the HasMedia trait, this package is no longer compatible with it.

You've succesfully updated your package to no longer have the collision with this function, by renaming GetMediaModel in your HasMediaLibrary Concern. But this function still calls GetMediaModel on the Layout class, while this function name can no longer be used in this context, because it expects a String as return, while it should return a HasMedia instance.

if you update getMediaModel to for example:

$model = $model->getCustomMediaModel();

and then in the Layout class:

 public function getCustomMediaModel()
    {
        return $this->model;
    }

it doesn't throw errors in the front anymore, but I know get another error in the nova admin

Call to a member function getMedia() on null

edit: this error in Nova was fixed by applying this #515 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant