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
show your code to understand 🙂
Select::make('category_id')
->label('Catégorie')
->options(Category::all()->pluck('name', 'id'))
->required()
->preload()
->live(onBlur: true)
->reactive()
->searchable()
pluck('name', 'name')
but how can i make relationship by name
??
not following? do you mean the
name
is a relationship?yes
i have now relation by id
Why would you want to do that? A relationship should rely on a unique ID and not a name.