ebess / advanced-nova-media-library

A Laravel Nova field for displaying, creating, updating and ordering a Spatie Media Library model.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

4n70w4 opened this issue · comments

I just use code from examples:

                Files::make('Single file', 'one_file'),
                Files::make('Multiple files', 'multiple_files'),

and get error on edit form:

Ebess\\AdvancedNovaMediaLibrary\\Fields\\Media::checkCollectionIsMultiple(): Argument #1 ($resource) must be of type Spatie\\MediaLibrary\\HasMedia, Nova\\MyEntity given, called in /var/www/html/vendor/ebess/advanced-nova-media-library/src/Fields/Media.php on line 299

but in create form no errors.

You're most likely missing implements HasMedia on your app class. (not the Nova resource)

class User extends Model implements HasMedia
{
    use InteractsWithMedia;
}