FilamentF
Filament2y ago
Abi

Composite Key validation when saving a record

I have the following components on the form of relation manager class
    public function form(Form $form): Form
    {
        return $form
            ->schema([
                Forms\Components\Select::make('option_1_value')
                    ->relationship('option1', 'key')
                    ->required(),

                Forms\Components\Select::make('option_2_value')
                    ->relationship('option2', 'key')
                    ->required(),

                Forms\Components\Select::make('option_3_value')
                    ->relationship('option3', 'key')
                    ->required(),
            ]);
    }

How can I validate unique combination selection for the parent resource when saving the form?
Was this page helpful?