Open xenorum opened 9 months ago
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 composer update
and try again?
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 "spatie/laravel-medialibrary": "^10.7",
Your is "spatie/laravel-medialibrary": "^10.0.0"
can you run composer update
and try again?
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). Would you care to share the "parent" model & "child" model + the CrudController with me?
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. https://github.com/Laravel-Backpack/CRUD/pull/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.
Hello, any news on this topic? Having the same issue.
Working on media library uploaders this week. Expect some news by the end of the week 👍
Cheers
Bump :-)
Thanks @xenorum , appreciate 🙏
this is being worked on in https://github.com/Laravel-Backpack/medialibrary-uploaders/pull/34
It has breaking changes, but shouldn't be noticeable if you are not overwriting a bunch of stuff.
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.