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

Argument #1 ($model) must be of type Spatie\\MediaLibrary\\HasMedia #165

Open
4n70w4 opened this issue Oct 3, 2022 · 1 comment
Open

Comments

@4n70w4
Copy link

4n70w4 commented Oct 3, 2022

Hi! I just try code from examples:

            Medialibrary::make('name', 'avatar')->single(),

            Medialibrary::make('Media')->fields(function () {
                return [
                    Text::make('File Name', 'file_name')
                        ->rules('required', 'min:2'),

                    Text::make('Tooltip', 'custom_properties->tooltip')
                        ->rules('required', 'min:2'),

                    GeneratedConversions::make('Conversions')
                        ->withTooltips(),
                ];
            }),

and get error on edit form:

DmitryBubyakin\\NovaMedialibraryField\\Fields\\Support\\ResolveMediaCallback::__invoke(): Argument #1 ($model) must be of type Spatie\\MediaLibrary\\HasMedia, Models\\Category given
@4n70w4
Copy link
Author

4n70w4 commented Oct 3, 2022

Okay. Need add implements HasMedia and use InteractsWithMedia; to Model.

May be need add handling this case and show userfriendly message?

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