-
Notifications
You must be signed in to change notification settings - Fork 4
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
[Bug] Method Spatie\MediaLibrary\MediaCollections\Models\Collections\MediaCollection::delete does not exist in a nested model #23
Comments
Hey @xenorum Your example repo is using a repeatable field So I created a similar field to test and I found upload & delete working for me: [
'name' => 'sub_posts',
'type' => 'repeatable',
'subfields' => [
[
'name' => 'title',
'wrapper' => [
'class' => 'col-md-3',
],
],
[
'name' => 'image',
'type' => 'image',
'withMedia' => [],
'wrapper' => [
'class' => 'col-md-9',
],
],
],
] MODEL protected $casts = [
'sub_posts' => 'array',
] can you run If you continue facing this issue, please share the error stack trace. |
Hey @xenorum Your example repo is using a repeatable field So I created a similar field to test and I found upload & delete working for me: [
'name' => 'sub_posts',
'type' => 'repeatable',
'subfields' => [
[
'name' => 'title',
'wrapper' => [
'class' => 'col-md-3',
],
],
[
'name' => 'image',
'type' => 'image',
'withMedia' => [],
'wrapper' => [
'class' => 'col-md-9',
],
],
],
] MODEL protected $casts = [
'sub_posts' => 'array',
] For now, the difference I found in your repo & my project is: Mine was using can you run If you continue facing this issue, please share the error stack trace. |
Composer update is not doing the trick. Also, with the changes you suggest, it seems the one-to-one relation is gone (not sure if that is an issue). FYI: stack trace here: https://flareapp.io/share/OmVwGRwP#stack Thanks in advance for your effort on checking this. |
@tabacitu Sorry for the direct mention, any chance you can shed some light on this 🙏 |
Hey @xenorum Sorry this took so long to acknowledge the problem and your example repo was using repeatable instead of has one-relationship field. I tested this again with HasOne - Relationship Field. It threw the error you mentioned. I'm assigning my colleague to fix it. Hey @pxpm I used Cave hasOne Monster Relationship to test it:
|
Hi, do you happen to have an update on this? |
Hey @xenorum sorry not yet. There was issues in Uploaders that need to be addressed before fixing stuff in this package. There are two PR's towards fixing uploaders stuff. Laravel-Backpack/CRUD#5440 for example. Only when we merge them I can spend time fixing this, I think it won't be wise working on this, when it's possible the problem is in the Uploaders and not on this specific package. This is on my list as soon as we merge the PR's that aim to fix uploaders. Sorry it took a little bit longer, I am actively working on the uploaders issue. Thanks for understanding and your patience. |
Hello, any news on this topic? Having the same issue. |
Working on media library uploaders this week. Cheers |
Bump :-) |
Bug report
What I did
Post
with a related model (HasOne)SubPost
with mediaPost
that includes a SubPostMethod Spatie\MediaLibrary\MediaCollections\Models\Collections\MediaCollection::delete does not exist.
arisesWhat I expected to happen
Media gets deleted and uploaded (if needed)
What I've already tried to fix it
I've tried also tried with a 'relationship' field, same error.
Context to replicate the bug - Backpack, Laravel, PHP, DB version
See https://github.com/xenorum/backpack-media-repeatable for an example of the setup
Thanks for your insights, I am stuck on this one.
The text was updated successfully, but these errors were encountered: