I installed Laravel Breeze in my Laravel 8 installation so I could easily get a user sign-up and registration system up and running. There is one problem that I'm having with this that I can't seem to solve.
When a user signs up, they enter their name, email and password (along with a confirmation of the password.) But only the email address and the created_at and updated_at timestamps are written to the users table, and I can't seem to figure out why. The store
function in the RegisteredUserController.php
file looks like this:
public function store(Request $request)
{
$request->validate([
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
echo $request->name;
echo $request->email;
echo $request->password;
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
]);
event(new Registered($user));
Auth::login($user);
return redirect(RouteServiceProvider::HOME);
}
Any help with this would be greatly appreciated.
CodePudding user response:
in your User model check the $fillable variable have name and password
protected $fillable = [
'name',
'email',
'password',
];