File tree Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Expand file tree Collapse file tree 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)
3737 public static function boot ()
3838 {
3939 parent ::boot ();
40+ $ class = get_called_class ();
41+ $ instance = new $ class ;
4042
41- static ::created (function () {
42- self :: flushCache ();
43+ static ::created (function () use ( $ instance ) {
44+ $ instance -> flushCache ();
4345 });
4446
45- static ::deleted (function () {
46- self :: flushCache ();
47+ static ::deleted (function () use ( $ instance ) {
48+ $ instance -> flushCache ();
4749 });
4850
49- static ::saved (function () {
50- self :: flushCache ();
51+ static ::saved (function () use ( $ instance ) {
52+ $ instance -> flushCache ();
5153 });
5254
53- static ::updated (function () {
54- self :: flushCache ();
55+ static ::updated (function () use ( $ instance ) {
56+ $ instance -> flushCache ();
5557 });
5658 }
5759
@@ -67,15 +69,8 @@ public function cache(array $tags = [])
6769 return $ cache ;
6870 }
6971
70- public static function flushCache (array $ tags = [])
72+ public function flushCache (array $ tags = [])
7173 {
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 ();
8075 }
8176}
You can’t perform that action at this time.
0 commit comments