Reputation: 286
my need is to add a new input as a dropdown type and with filled default options to laravel.8 jetstream registration form. my problems are:
Upvotes: 2
Views: 1711
Reputation: 1833
I understand this is not a full answer to all of your questions but should help.
<label for="cars">Choose a car:</label>
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
app/Actions/Fortify/CreateNewUser.php
accessing the array. The following inserts the new value into the database:return User::create([
'name' => $input['name'],
'email' => $input['email'],
'car' => $input['cars']),
'password' => Hash::make($input['password']),
'api_token' => Str::random(60),
]);
You will also need to update the app/Models/User.php
Model and add the new value as fillable (and of course have added the field to your User
Model via a migration):
protected $fillable = [
'name',
'email',
'password',
'car',
];
Upvotes: 1