diff options
author | Sam Light <sam@lightscale.co.uk> | 2025-04-09 22:36:46 +0100 |
---|---|---|
committer | Sam Light <samlight1994@gmail.com> | 2025-04-09 22:36:46 +0100 |
commit | a9c9be7cf24a72d59a45769067ed5f4f8ffc87d1 (patch) | |
tree | 8ad663b78bda27fbbfc57368686bf82989edbb3e | |
parent | 7103661c509efb941d700f5cc0bdcb7dd5ca276d (diff) |
Make accessLog Model prune andle null max_age_daysv1.0.1
-rw-r--r-- | src/Models/AccessLog.php | 5 |
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)); } } |