More Facades, User delete

This commit is contained in:
Kilian committed 2024-07-22 00:56:04 +02:00
1 parent 4b89a7e9ca
commit 7b897071f5
14 files changed
+177 -63

No files matched your search

+10 -1
View File
@@ -18,8 +18,9 @@ class User implements JsonSerializable
private ?string $image;
private bool $isAdmin;
private DateTime $memberSince;
private int $postCount;
protected function __construct(int $id, string $username, int $status, string $email, string $timestamp, string $image, bool $isAdmin)
protected function __construct(int $id, string $username, int $status, string $email, string $timestamp, ?string $image, bool $isAdmin)
{
$this->id = $id;
$this->username = $username;
@@ -171,6 +172,14 @@ class User implements JsonSerializable
return true;
}
public function delete()
{
$db = Database::getInstance();
$stmt = $db->prepare("DELETE FROM egb_benutzer WHERE id = :ID");
$stmt->bindValue(":ID", $this->id);
return $stmt->execute();
}
/*
* Getters
*/