F
Filament17mo ago
Vp

[v2] Multiple images with relationship

I have this form
// file upload
Forms\Components\FileUpload::make('images.image')
->image()
->multiple()

// model
public function images(): HasMany
{
return $this->hasMany(LandingMFile::class, 'file_id');
}
// file upload
Forms\Components\FileUpload::make('images.image')
->image()
->multiple()

// model
public function images(): HasMany
{
return $this->hasMany(LandingMFile::class, 'file_id');
}
But after clicking submit, the image not save.. any idea? I put fillable, no console error, no error at all.. but image is not save
2 Replies
awcodes
awcodes17mo ago
Dot syntax only works in tables. You’ll need to wrap the FileUpload in something like Group::make(‘images’) and use -relationship() on the group. And make the FileUpload::make(‘image’) in the group schema.
Vp
VpOP17mo ago
Thanks @awcodes apparently "Relation managers" are compatible with HasMany, so decided to switch to relation manager..
Want results from more Discord servers?
Add your server