Trying to add some fields to the registration method in Laravel:auth. I've successfully added them to the view and the database (checked visually for the view, in phpMyAdmin for the DB), updated the controller's validator:
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'type' => 'required|max:255', //new
'222' => 'required|max:255', //new
'password' => 'required|min:6|confirmed',
]);
as well as updated the controller's create function:
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'type' => $data['type'], //new
'222' => $data['fees'], //new
'password' => bcrypt($data['password']),
]);
And then topped it off by updating the Model:
protected $hidden = [
'type','fees','password', 'remember_token',
];
But... well it doesn't work. The SQL created doesn't include my new fields and therefore returns an error as the DB doesn't have default values for them..
SQLSTATE[HY000]: General error: 1364 Field '222' doesn't have a default value
Am I missing something?
Any help would be appreciated!
via Frenchmassacre