F
Filament•9mo ago
brahim

How can i save name of select and not id in db

How can i save name of select and not id in db
7 Replies
Lara Zeus
Lara Zeus•9mo ago
show your code to understand 🙂
brahim
brahim•9mo ago
Select::make('category_id') ->label('Catégorie') ->options(Category::all()->pluck('name', 'id')) ->required() ->preload() ->live(onBlur: true) ->reactive() ->searchable()
Lara Zeus
Lara Zeus•9mo ago
pluck('name', 'name')
brahim
brahim•9mo ago
but how can i make relationship by name ??
Lara Zeus
Lara Zeus•9mo ago
not following? do you mean the name is a relationship?
brahim
brahim•9mo ago
yes i have now relation by id
Dennis Koch
Dennis Koch•9mo ago
Why would you want to do that? A relationship should rely on a unique ID and not a name.