Closed iAmKevinMcKee closed 11 months ago
The problem is related to the order of the methods. In relationship you have a method createOptionUsing, try: Forms\Components\Select::make('state_id')->relationship(...)-> createOptionUsing(...); I haven't tested, I might be wrong, but from what I remember, it should work
Package
filament/filament
Package Version
v3.1.24
Laravel Version
v10.38.0
Livewire Version
v3.3.2
PHP Version
PHP 8.2
Problem description
When you are trying to create a new option from a Select with
->createOptionForm
and you want to customize the behavior using->createOptionUsing
, this does not work. Filament still tries to create and save the related model based on the form inputs.For example:
In this case, my State model only has a name. However, if I want to collect some other data like in the
not_present
text input, and then do something else with it before creating the state, I can't do it.Expected behavior
I expect
->createOptionUsing(...)
will prevent the default behavior and give me full control over what I do with the user input.Steps to reproduce
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'not_present' in 'field list'
Reproduction repository
https://github.com/iAmKevinMcKee/filtest
Relevant log output