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

Cannot retrieve media using getMedia() #3744

Open
Kenneth-Inkum opened this issue Dec 10, 2024 · 1 comment
Open

Cannot retrieve media using getMedia() #3744

Kenneth-Inkum opened this issue Dec 10, 2024 · 1 comment

Comments

@Kenneth-Inkum
Copy link

I'm using "spatie/laravel-medialibrary": "^11.10", in Laravel 11.31 and I can no longer use fluent methods getMedia(), getFirstMedia() etc It always returns an empty collection even though the records exist in db. However, $model->media()->where('collection_name', 'collection_name')->get() works fine.

@timgavin
Copy link
Contributor

Have you tried passing the collection name?

// works for me
$model->getMedia('images');

// works for me
$model->getMedia('*');

// doesn't work for me
$model->getMedia();

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

2 participants