This commit is contained in:
torsten 2026-10-23 13:14:31 +02:00
parent 1db373a03d
commit 9bcbd3e194
118 changed files with 1116 additions and 155 deletions

View file

@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace App\Models;
use App\Core\Model;
class User extends Model
{
protected static string $table = 'users';
public static function byEmail(string $email): ?static
{
$row = db()->fetchOne('SELECT * FROM `users` WHERE email = ?', [$email]);
return $row === null ? null : static::fromRow($row);
}
public function isAdmin(): bool
{
return $this->role === 'ADMIN';
}
public function isMember(): bool
{
return $this->role === 'MEMBER';
}
}