form input default value not passed

Here is my code Select::make('site') ->relationship(name: 'site', titleAttribute: 'name') ->default(Auth::user()->person->site_id) ->createOptionForm([ Forms\Components\TextInput::make('name') ->required(), ]), Select displays correctly as expected but when press create get error as no data passed from this select. By default I want the select to be the logged in users site. Which it does display but goes blank when press create
Solution:
Don't use relationship() if you dont' want to save it to a relationship
Jump to solution
4 Replies
Dennis Koch
Dennis Koch15mo ago
The data is saved directly to the relationship and not included in the data for the actual model
Tuathanach
TuathanachOP15mo ago
What is best way to get the data so it can be saved with form in the database
Solution
Dennis Koch
Dennis Koch15mo ago
Don't use relationship() if you dont' want to save it to a relationship
Want results from more Discord servers?
Add your server