From 5b045335a1be7b957f992fd8ee400b9a8421d9c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sun, 24 Sep 2023 00:47:55 +0200 Subject: [PATCH] add username to user model --- src/PersistentData/Model/User.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/PersistentData/Model/User.php b/src/PersistentData/Model/User.php index e619b65..6928072 100644 --- a/src/PersistentData/Model/User.php +++ b/src/PersistentData/Model/User.php @@ -8,12 +8,14 @@ class User extends Model implements IUser { protected static string $table = 'users'; - protected static array $fields = ['email', 'password', 'type', 'active', 'google_sub', 'created']; + protected static array $fields = ['email', 'username', 'password', 'type', 'active', 'google_sub', 'created']; private static array $types = ['user', 'admin']; private string $email = ''; + private string $username = ''; + private ?string $password = null; private string $type = 'user'; @@ -29,6 +31,11 @@ class User extends Model implements IUser $this->email = $email; } + public function setUsername(string $username): void + { + $this->username = $username; + } + public function setPassword(?string $hashedPassword): void { $this->password = $hashedPassword; @@ -71,6 +78,11 @@ class User extends Model implements IUser return $this->email; } + public function getUsername(): string + { + return $this->username; + } + public function getPassword(): ?string { return $this->password;