More Facades, User delete
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user