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
{
$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],
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
$user = User::create([
'name' => $request->name,
'firstname' => $request->firstname,
'lastname' => $request->lastname,
'username' => $request->username,
'email' => $request->email,
'password' => Hash::make($request->password),
]);

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

Loading…
Cancel
Save