File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change 11
11
trait Cachable
12
12
{
13
13
protected $ isCachable = true ;
14
- protected static $ isCachableKey = 'genealabs:laravel-model-caching:is-disabled ' ;
15
14
16
15
protected function cache (array $ tags = [])
17
16
{
@@ -43,8 +42,6 @@ protected function addTagsWhenCalledFromCachedBuilder(array $tags) : array
43
42
44
43
public function disableCache ()
45
44
{
46
- cache ()->forever (self ::$ isCachableKey , true );
47
-
48
45
$ this ->isCachable = false ;
49
46
50
47
return $ this ;
@@ -89,10 +86,6 @@ public static function bootCachable()
89
86
90
87
public static function all ($ columns = ['* ' ])
91
88
{
92
- if (! cache ()->get (self ::$ isCachableKey )) {
93
- return parent ::all ($ columns );
94
- }
95
-
96
89
$ class = get_called_class ();
97
90
$ instance = new $ class ;
98
91
$ tags = [str_slug (get_called_class ())];
@@ -106,8 +99,8 @@ public static function all($columns = ['*'])
106
99
107
100
public function newEloquentBuilder ($ query )
108
101
{
109
- if (cache ()-> get ( self :: $ isCachableKey ) ) {
110
- cache ()-> forget ( self :: $ isCachableKey ) ;
102
+ if (! $ this -> isCachable ) {
103
+ $ this -> isCachable = true ;
111
104
112
105
return new EloquentBuilder ($ query );
113
106
}
You can’t perform that action at this time.
0 commit comments