© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
Joanne

Repeater shows only the first item on edit form

Hi, newbie here. I am using repeater to allow user to upload images when create article.
The repeater repeatedly displays only the first image that was originally uploaded on edit form

I have checked the data in the mutateFormDataBeforeFill function. The array of images ($data['images']) appears to contain all the uploaded images, but for some reason, only the first image is being displayed repeatedly.

Repeater::make('images')                            
  ->schema([                      Forms\Components\SpatieMediaLibraryFileUpload::make('image')
  ->label('Image')
  ->collection(Article::MEDIA_COLLECTION_NAME)
  ->columnSpan('full')
  ->customProperties(['is_cover' => false])
  // disk is s3_public 
  ->disk(function () {
      if (config('filesystems.default') === 's3') {               return 's3_public';
          }
    })
  ->acceptedFileTypes(['image/*'])
  ->maxFiles(1)
  ->rules('image'),
  ])
  ->maxItems(20)
  ->collapsible()
  ->columnSpan('full')
  ->orderable('order_column')
  ->hidden(fn (Closure $get) => $get('type') !==     'multimedia'),
Repeater::make('images')                            
  ->schema([                      Forms\Components\SpatieMediaLibraryFileUpload::make('image')
  ->label('Image')
  ->collection(Article::MEDIA_COLLECTION_NAME)
  ->columnSpan('full')
  ->customProperties(['is_cover' => false])
  // disk is s3_public 
  ->disk(function () {
      if (config('filesystems.default') === 's3') {               return 's3_public';
          }
    })
  ->acceptedFileTypes(['image/*'])
  ->maxFiles(1)
  ->rules('image'),
  ])
  ->maxItems(20)
  ->collapsible()
  ->columnSpan('full')
  ->orderable('order_column')
  ->hidden(fn (Closure $get) => $get('type') !==     'multimedia'),


the mutateFormDataBeforeFill function:

    protected function mutateFormDataBeforeFill(array $data): array
    {
        $data['images'] = $this->record->getMedia(Article::MEDIA_COLLECTION_NAME)->toArray();
        dd($data['images']);
        return $data;
    }
    protected function mutateFormDataBeforeFill(array $data): array
    {
        $data['images'] = $this->record->getMedia(Article::MEDIA_COLLECTION_NAME)->toArray();
        dd($data['images']);
        return $data;
    }


Appreciate any insights on how I might resolve this issue.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Repeater BelongsToMany not working on edit form
FilamentFFilament / ❓┊help
3y ago
Testing edit form with repeater
FilamentFFilament / ❓┊help
2y ago
Repeater - deletable except for first item
FilamentFFilament / ❓┊help
16mo ago
How to show image only in Edit form with repeater
FilamentFFilament / ❓┊help
2y ago