Forms\Components\Repeater::make('content')
->label('Sections')
->schema([
Forms\Components\TextInput::make('title')->label('Section Title'),
Forms\Components\RichEditor::make('body')->label('Content'),
Forms\Components\Hidden::make('image_id')
->default(fn() => Str::random(12)),
SpatieMediaLibraryFileUpload::make('image')
->collection('service')
->disk('public')
->responsiveImages()
->image()
->maxSize(2048)
->customProperties(fn(Forms\Get $get) => ['gallery_id' => $get('gallery_id')])
->filterMediaUsing(function (Collection $media, Forms\Get $get) {
return $media->filter(function (Media $item) use ($get) {
return $item->custom_properties['gallery_id'] === $get('gallery_id');
});
})
])
Forms\Components\Repeater::make('content')
->label('Sections')
->schema([
Forms\Components\TextInput::make('title')->label('Section Title'),
Forms\Components\RichEditor::make('body')->label('Content'),
Forms\Components\Hidden::make('image_id')
->default(fn() => Str::random(12)),
SpatieMediaLibraryFileUpload::make('image')
->collection('service')
->disk('public')
->responsiveImages()
->image()
->maxSize(2048)
->customProperties(fn(Forms\Get $get) => ['gallery_id' => $get('gallery_id')])
->filterMediaUsing(function (Collection $media, Forms\Get $get) {
return $media->filter(function (Media $item) use ($get) {
return $item->custom_properties['gallery_id'] === $get('gallery_id');
});
})
])