Updated the proostekrant to work properly again.

This commit is contained in:
douwe
2026-10-09 10:33:21 +02:00
parent 56d143b74b
commit 256a81a770
133 changed files with 10491 additions and 837 deletions
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace App\Models;
class User {
private static $table = 'users';
public static function all() {
$db = Database::getInstance();
return $db->fetchAll("SELECT * FROM " . self::$table . " WHERE is_active = 1 ORDER BY display_name");
}
public static function find($id) {
$db = Database::getInstance();
return $db->fetch("SELECT * FROM " . self::$table . " WHERE id = ?", [$id]);
}
public static function findByUsername($username) {
$db = Database::getInstance();
return $db->fetch("SELECT * FROM " . self::$table . " WHERE username = ? AND is_active = 1", [$username]);
}
public static function getByIds($ids) {
if (empty($ids)) return [];
$placeholders = implode(',', array_fill(0, count($ids), '?'));
$db = Database::getInstance();
return $db->fetchAll("SELECT * FROM " . self::$table . " WHERE id IN ({$placeholders}) AND is_active = 1", $ids);
}
public static function updateProfileImage($userId, $imagePath) {
$db = Database::getInstance();
return $db->update(self::$table, ['profile_image' => $imagePath], ['id' => $userId]);
}
}