File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 7
7
use Filament \View \PanelsRenderHook ;
8
8
use Illuminate \Database \Eloquent \Factories \HasFactory ;
9
9
use Illuminate \Database \Eloquent \Model ;
10
+ use Illuminate \Support \Facades \Cache ;
10
11
use Laragear \TwoFactor \Contracts \TwoFactorAuthenticatable ;
11
12
use Visualbuilder \Filament2fa \Database \Factories \BannerFactory ;
12
13
@@ -46,6 +47,22 @@ class Banner extends Model
46
47
47
48
protected $ table = 'two_factor_banners ' ;
48
49
50
+ protected static function booted ()
51
+ {
52
+ parent ::booted ();
53
+
54
+ // When a banner is created or updated
55
+ static ::saved (function ($ banner ) {
56
+ Cache::forget ('all_banners ' );
57
+ });
58
+
59
+ // When a banner is deleted
60
+ static ::deleted (function ($ banner ) {
61
+ Cache::forget ('all_banners ' );
62
+ });
63
+ }
64
+
65
+
49
66
/**
50
67
* @return BannerFactory
51
68
*/
You can’t perform that action at this time.
0 commit comments