Flush cache on subscription changes

This commit is contained in:
Julien Nahum
2023-12-03 15:02:48 +01:00
parent 508358d020
commit 57c695e976
6 changed files with 59 additions and 9 deletions

View File

@@ -51,4 +51,18 @@ class License extends Model
3 => null,
][$this->meta['tier']];
}
public static function booted(): void
{
static::saved(function (License $license) {
if ($license->user) {
$license->user->flushCache();
}
});
static::deleted(function (License $license) {
if ($license->user) {
$license->user->flushCache();
}
});
}
}