Add per-column filters, smart pagination (25/page), and date range filter to audit logs

This commit is contained in:
2026-06-07 12:43:50 -04:00
parent 4448dec60d
commit cd24cc53a0
4 changed files with 278 additions and 33 deletions

View File

@@ -157,11 +157,27 @@ class AuditService
$params[] = $filters['user_id'];
}
if (!empty($filters['username'])) {
$where[] = '(al.username LIKE ? OR u.username LIKE ?)';
$params[] = '%' . $filters['username'] . '%';
$params[] = '%' . $filters['username'] . '%';
}
if (!empty($filters['entity_type'])) {
$where[] = 'al.entity_type = ?';
$params[] = $filters['entity_type'];
}
if (!empty($filters['ip_address'])) {
$where[] = 'al.ip_address LIKE ?';
$params[] = '%' . $filters['ip_address'] . '%';
}
if (!empty($filters['details'])) {
$where[] = 'al.details LIKE ?';
$params[] = '%' . $filters['details'] . '%';
}
if (!empty($filters['date_from'])) {
$where[] = 'al.created_at >= ?';
$params[] = $filters['date_from'];