diff --git a/app/Models/Forms/Form.php b/app/Models/Forms/Form.php index e76f399..6afadac 100644 --- a/app/Models/Forms/Form.php +++ b/app/Models/Forms/Form.php @@ -218,7 +218,7 @@ class Form extends Model implements CachableAttributes public function getMaxNumberOfSubmissionsReachedAttribute() { - $this->disableCache('submissions_count'); + $this->forget('submissions_count'); return ($this->max_submissions_count && $this->max_submissions_count <= $this->submissions_count); } diff --git a/app/Models/Traits/CachesAttributes.php b/app/Models/Traits/CachesAttributes.php index b70d416..0b035d2 100644 --- a/app/Models/Traits/CachesAttributes.php +++ b/app/Models/Traits/CachesAttributes.php @@ -20,8 +20,6 @@ trait CachesAttributes /** @var array */ protected $attributeCache = []; - protected $disabledCache = []; - public static function bootCachesAttributes(): void { static::deleting(function (Model $model): void { @@ -30,18 +28,8 @@ trait CachesAttributes }); } - public function disableCache($key) - { - $this->disabledCache[] = $key; - return $this; - } - public function remember(string $attribute, ?int $ttl, Closure $callback) { - if (in_array($attribute, $this->disabledCache)) { - return value($callback); - } - if ($ttl === 0 || ! $this->exists) { if (! isset($this->attributeCache[$attribute])) { $this->attributeCache[$attribute] = value($callback);