Create Options Forms on a Select

Hello how can i create an option Forms on my non-relationship Select : Forms\Components\Repeater::make('userFonctions') ->relationship() ->schema([ Forms\Components\Select::make('fonction_id') ->label('Fonction') ->options(Fonction::query()->pluck('name', 'id')) ->required() ->columnSpan([ 'md' => 5, ]) ->searchable() ->createOptionForm([ Forms\Components\TextInput::make('name') ->label('nom') ->unique(ignoreRecord: true) ->maxLength(255) ->required(), Forms\Components\TextInput::make('diminutif') ->label('Abréviation') ->unique(ignoreRecord: true) ->maxLength(255) ->required(), ]),
6 Replies
Dennis Koch
Dennis Koch2y ago
Same way, but I think you need to manually save it. I think there is a ->createOptionUsing() method or similar to modify the behaviour Also please use triple backticks to format the code (seems like you used single backticks). It's not very readable
karim charfaoui
karim charfaouiOP2y ago
ok ty
ok
ok
DrByte
DrByte2y ago
eg:
// code here gets syntax-highlighted and is easier to read
// code here gets syntax-highlighted and is easier to read
No description
karim charfaoui
karim charfaouiOP2y ago
@Dennis Koch plz do you have any example @DrByte
// ok
// ok
DrByte
DrByte2y ago
GitHub
filament/packages/forms/src/Components/Select.php at 751c24beb998e3...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
karim charfaoui
karim charfaouiOP2y ago
Merci

Did you find this page helpful?