summaryrefslogtreecommitdiff
path: root/src/Models
diff options
context:
space:
mode:
authorSam Light <sam@lightscale.co.uk>2025-04-09 22:36:46 +0100
committerSam Light <samlight1994@gmail.com>2025-04-09 22:36:46 +0100
commita9c9be7cf24a72d59a45769067ed5f4f8ffc87d1 (patch)
tree8ad663b78bda27fbbfc57368686bf82989edbb3e /src/Models
parent7103661c509efb941d700f5cc0bdcb7dd5ca276d (diff)
Make accessLog Model prune andle null max_age_daysv1.0.1
Diffstat (limited to 'src/Models')
-rw-r--r--src/Models/AccessLog.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Models/AccessLog.php b/src/Models/AccessLog.php
index 0c177a3..2cb510c 100644
--- a/src/Models/AccessLog.php
+++ b/src/Models/AccessLog.php
@@ -39,6 +39,9 @@ class AccessLog extends Model
public function prunable(): Builder
{
$days = config('access_log.max_age_days');
- return static::where(static::CREATED_AT, '<=', now()->subDays($days));
+ if ($days === null) {
+ return static::whereRaw('1 = 0');
+ }
+ else return static::where(static::CREATED_AT, '<=', now()->subDays($days));
}
}