Dimitry Solunsky
Dimitry Solunsky
FFilament
Created by juin.lima on 2/15/2024 in #❓┊help
Unique Multiple Columns
This solution in my job work, check please
Forms\Components\Select::make('warehouse_id')
->relationship('warehouse', 'name')
->searchable()
->preload()
->required()
->live(),

Forms\Components\Select::make('product_id')
->relationship('product', 'name')
->searchable()
->preload()
->required()
->unique(ignoreRecord: true, modifyRuleUsing: function (Unique $rule, Get $get) {
return $rule
->where('warehouse_id', $get('warehouse_id'));
}),
Forms\Components\Select::make('warehouse_id')
->relationship('warehouse', 'name')
->searchable()
->preload()
->required()
->live(),

Forms\Components\Select::make('product_id')
->relationship('product', 'name')
->searchable()
->preload()
->required()
->unique(ignoreRecord: true, modifyRuleUsing: function (Unique $rule, Get $get) {
return $rule
->where('warehouse_id', $get('warehouse_id'));
}),
4 replies
FFilament
Created by undefined on 8/6/2023 in #❓┊help
Spatie translatable relation select return json
I dont know why spatie not return default locale, maybe see config file. but fast solution, TextColumn::make('category.ru').
22 replies