From b9f43428d8d045a97e55179658e818b4a3cf87cf Mon Sep 17 00:00:00 2001 From: Alexis Gousseau Date: Mon, 25 Aug 2025 14:22:50 +0200 Subject: [PATCH] fix: :bug: call the cache reset method on every model event for the claim subject and template --- app/Models/ClaimMailTemplate.php | 18 ++++++++++++++++++ app/Models/ClaimSubject.php | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/app/Models/ClaimMailTemplate.php b/app/Models/ClaimMailTemplate.php index 8393ead..c461d3b 100644 --- a/app/Models/ClaimMailTemplate.php +++ b/app/Models/ClaimMailTemplate.php @@ -29,6 +29,24 @@ class ClaimMailTemplate extends Model 'brand_id', ]; + /** + * Perform any actions required after the model boots. + * + * @return void + */ + protected static function booted(): void + { + static::created(function () { + self::resetCache(); + }); + static::updated(function () { + self::resetCache(); + }); + static::deleted(function () { + self::resetCache(); + }); + } + // * METHODS /** diff --git a/app/Models/ClaimSubject.php b/app/Models/ClaimSubject.php index 6b38d68..70e2f89 100644 --- a/app/Models/ClaimSubject.php +++ b/app/Models/ClaimSubject.php @@ -27,6 +27,24 @@ class ClaimSubject extends Model 'brand_id', ]; + /** + * Perform any actions required after the model boots. + * + * @return void + */ + protected static function booted(): void + { + static::created(function () { + self::resetCache(); + }); + static::updated(function () { + self::resetCache(); + }); + static::deleted(function () { + self::resetCache(); + }); + } + // * METHODS /**