From a9c9be7cf24a72d59a45769067ed5f4f8ffc87d1 Mon Sep 17 00:00:00 2001 From: Sam Light Date: Wed, 9 Apr 2025 22:36:46 +0100 Subject: Make accessLog Model prune andle null max_age_days --- src/Models/AccessLog.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Models/AccessLog.php') 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)); } } -- cgit v1.2.3