Repeater and SpatieUpload Fill
Trying to do set a repeater field using with the repeater having . Im filling the name file, but getting . Tried a few different ideas with media() on 'attachment', but im obviously missing something simple.
->afterStateUpdated(function (Get $get, Set $set) {
$this->participant = Participant::find($get('participant_id'));
$mediaItems = $this->participant->media;
$attachments = $mediaItems->map(function ($media) {
return [
'attachment' => $media,
'name' => $media->collection_name,
];
})->toArray();
ray($attachments)->label('Attachments');
$set('attachments', $attachments);
})->afterStateUpdated(function (Get $get, Set $set) {
$this->participant = Participant::find($get('participant_id'));
$mediaItems = $this->participant->media;
$attachments = $mediaItems->map(function ($media) {
return [
'attachment' => $media,
'name' => $media->collection_name,
];
})->toArray();
ray($attachments)->label('Attachments');
$set('attachments', $attachments);
})->schema([
SpatieMediaLibraryFileUpload::make('attachment')
->previewable(false)
->reactive()
->required()
->hiddenLabel(),
TextInput::make('name')
->hiddenLabel()
->placeholder('File Name')
->reactive()
->required(),
]),->schema([
SpatieMediaLibraryFileUpload::make('attachment')
->previewable(false)
->reactive()
->required()
->hiddenLabel(),
TextInput::make('name')
->hiddenLabel()
->placeholder('File Name')
->reactive()
->required(),
]),Filament\Forms\Components\SpatieMediaLibraryFileUpload::Filament\Forms\Components\{closure}(): Argument #2 ($file) must be of type string, array given, called in /#######/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35Filament\Forms\Components\SpatieMediaLibraryFileUpload::Filament\Forms\Components\{closure}(): Argument #2 ($file) must be of type string, array given, called in /#######/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35