Fix User model

main
Alex 2 years ago
parent 127fcab869
commit 2f484eddcb

@ -31,13 +31,17 @@ class RegisteredUserController extends Controller
public function store(Request $request): RedirectResponse public function store(Request $request): RedirectResponse
{ {
$request->validate([ $request->validate([
'name' => ['required', 'string', 'max:255'], 'firstname' => ['required', 'string', 'max:255'],
'lastname' => ['required', 'string', 'max:255'],
'username' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:'.User::class], 'email' => ['required', 'string', 'email', 'max:255', 'unique:'.User::class],
'password' => ['required', 'confirmed', Rules\Password::defaults()], 'password' => ['required', 'confirmed', Rules\Password::defaults()],
]); ]);
$user = User::create([ $user = User::create([
'name' => $request->name, 'firstname' => $request->firstname,
'lastname' => $request->lastname,
'username' => $request->username,
'email' => $request->email, 'email' => $request->email,
'password' => Hash::make($request->password), 'password' => Hash::make($request->password),
]); ]);

@ -18,7 +18,9 @@ class User extends Authenticatable
* @var array<int, string> * @var array<int, string>
*/ */
protected $fillable = [ protected $fillable = [
'name', 'firstname',
'lastname',
'username',
'email', 'email',
'password', 'password',
]; ];

Loading…
Cancel
Save