How to ignore save relation when FileUpload is empty?

I have this code:
Forms\Components\Group::make()
->relationship('image')
->schema([
Forms\Components\FileUpload::make('path'),
]),
Forms\Components\Group::make()
->relationship('image')
->schema([
Forms\Components\FileUpload::make('path'),
]),
If FileUpload was empty when saving, its return error cause trying to save the relation. Any way to skip the saving relation when FileUpload empty?
2 Replies
LeandroFerreira
LeandroFerreira16mo ago
Filament
Creating records - Resources - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
MohamedSabil83
MohamedSabil8316mo ago
I'll check if I can ignore saving relation from their. btw, I already did it by using ->saveRelationshipsUsing($record, $state). If filled $state, then, save the relation as you need using $record and the content of $state. Just looking if there's a simple/direct method to do that.