It is simple as adding a new field in database and form. Go through the basic documentation of Laravel before jumping into it.
Basically, follow these steps:
1) Add a new column to your database table (ie: 'users' table)
ALTER TABLE `users` ADD `address` TEXT NOT NULL AFTER `name`;
(This is just a raw format to add the field for a basic user, Best way to add field is to use laravel migration)
2) Add an input field to registration form page (register.blade.php
)
<input id="address" type="text" class="form-control" name="address" value="{{ old('address') }}" required>
3) Make change on your RegisterController.php
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'address' => $data['address'],
'password' => bcrypt($data['password']),
]);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…