Add a custom property to a SpatieMediaLibraryFileUpload based on another text field in Repeater
Repeater::make('gallery')
->schema([
SpatieMediaLibraryFileUpload::make('image')
->collection('gallery')
->customProperties(['caption' => '...'])
->image()
->required(),
TextInput::make('caption')
->required(),
])
->addActionLabel('Add image'),
how to set the caption property based on the text input field?7 Replies
maybe?
It doesn't work: "Column not found: 1054 Unknown column 'gallery' in 'field list'"
ohh sorry. SpatieMediaLibrary is associated with your model, so I think you can't add this in the repeater
Did you follow the instructions?
https://filamentphp.com/plugins/filament-spatie-media-library#installation
https://spatie.be/docs/laravel-medialibrary/v11/basic-usage/preparing-your-model
Preparing your model | laravel-medialibrary
laravel-medialibrary
Filament
Spatie Media Library by Filament - Filament
Filament support for Spatie's Laravel Media Library package.
Yes, I do, and it works with something like,
SpatieMediaLibraryFileUpload::make('gallery')
->multiple()
->collection('gallery')
but now I want to add a caption for images.
Is there another way to add a caption without a Repeater?customProperties
I think, but not by file, if you are using multiple
I think curator has this option: https://filamentphp.com/plugins/awcodes-curator
Maybe you could check this or other plugins to achieve what you needThe problem is that the curator package doesn't support the Spatie Media Library.