File tree 1 file changed +12
-17
lines changed 1 file changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -37,21 +37,23 @@ public function newEloquentBuilder($query)
37
37
public static function boot ()
38
38
{
39
39
parent ::boot ();
40
+ $ class = get_called_class ();
41
+ $ instance = new $ class ;
40
42
41
- static ::created (function () {
42
- self :: flushCache ();
43
+ static ::created (function () use ( $ instance ) {
44
+ $ instance -> flushCache ();
43
45
});
44
46
45
- static ::deleted (function () {
46
- self :: flushCache ();
47
+ static ::deleted (function () use ( $ instance ) {
48
+ $ instance -> flushCache ();
47
49
});
48
50
49
- static ::saved (function () {
50
- self :: flushCache ();
51
+ static ::saved (function () use ( $ instance ) {
52
+ $ instance -> flushCache ();
51
53
});
52
54
53
- static ::updated (function () {
54
- self :: flushCache ();
55
+ static ::updated (function () use ( $ instance ) {
56
+ $ instance -> flushCache ();
55
57
});
56
58
}
57
59
@@ -67,15 +69,8 @@ public function cache(array $tags = [])
67
69
return $ cache ;
68
70
}
69
71
70
- public static function flushCache (array $ tags = [])
72
+ public function flushCache (array $ tags = [])
71
73
{
72
- $ cache = cache ();
73
-
74
- if (is_subclass_of (cache ()->getStore (), TaggableStore::class)) {
75
- array_push ($ tags , str_slug (get_called_class ()));
76
- $ cache = cache ()->tags ($ tags );
77
- }
78
-
79
- $ cache ->flush ();
74
+ $ this ->cache ($ tags )->flush ();
80
75
}
81
76
}
You can’t perform that action at this time.
0 commit comments