Update product fires 3 saved events

Hi guys, when I save product that belongs to category and manufacturer, it fires three times saved event on model Product? What am I doing wrong?
Forms\Components\Card::make()
->schema([
Forms\Components\Select::make('category_id')
->label(__('Category'))
->relationship('category', 'name'),

Forms\Components\Select::make('manufacturer_id')
->label(__('Manufacturer'))
->relationship('manufacturer', 'name'),
]),
Forms\Components\Card::make()
->schema([
Forms\Components\Select::make('category_id')
->label(__('Category'))
->relationship('category', 'name'),

Forms\Components\Select::make('manufacturer_id')
->label(__('Manufacturer'))
->relationship('manufacturer', 'name'),
]),
3 Replies
Trauma Zombie
Trauma ZombieOP17mo ago
It is also happening in ProductResource on Filament demo, because of this select:
Forms\Components\Select::make('shop_brand_id')
->relationship('brand', 'name')
->searchable()
->hiddenOn(ProductsRelationManager::class),
Forms\Components\Select::make('shop_brand_id')
->relationship('brand', 'name')
->searchable()
->hiddenOn(ProductsRelationManager::class),
Anyone can help me please?
Dennis Koch
Dennis Koch17mo ago
It's because of the relationships, which are saved individually. Remove the ->relationship() method and pull the options yourself via ->options(...)
Trauma Zombie
Trauma ZombieOP17mo ago
You saved me. Thank you.
Want results from more Discord servers?
Add your server