In the normal auth scaffold there is a 'name' field and I changed this to 'voornaam'. But since I did that it gives me this error:
SQLSTATE[HY000]: General error: 1364 Field 'voornaam' doesn't have a default value (SQL: insert into
people(password,updated_at,created_at) values (****@hotmail.com, $2y$10$MD1lSAS1XyA3tW3MzCE68Oz9zrPDZiq0CLJRo3KEnEC/uI2K8kLui, 2017-05-08 16:03:42, 2017-05-08 16:03:42))
It doesn't insert anything into voornaam.
This is my Register Controller:
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
protected $table = 'people';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'voornaam' => 'required|max:255',
'email' => 'required|email|max:255|unique:people',
'password' => 'required|min:6|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
return User::create([
'voornaam' => $data['voornaam'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
And this is the HTML part:
<div class="col-md-6">
<input id="voornaam" type="text" class="form-control" name="voornaam" value="" required autofocus>
@if ($errors->has('voornaam'))
<span class="help-block">
<strong></strong>
</span>
@endif
</div>
What am I doing wrong?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire