Add per-column filters, smart pagination (25/page), and date range filter to audit logs
This commit is contained in:
@@ -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'];
|
||||
|
||||
Reference in New Issue
Block a user