File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public static function all($columns = ['*'])
55
55
$ class = get_called_class ();
56
56
$ instance = new $ class ;
57
57
$ tags = [str_slug (get_called_class ())];
58
- $ key = makeCacheKey ();
58
+ $ key = $ instance -> makeCacheKey ();
59
59
60
60
return $ instance ->cache ($ tags )
61
61
->rememberForever ($ key , function () use ($ columns ) {
Original file line number Diff line number Diff line change 4
4
use GeneaLabs \LaravelModelCaching \CacheTags ;
5
5
use GeneaLabs \LaravelModelCaching \CachedModel ;
6
6
use Illuminate \Cache \TaggableStore ;
7
+ use Illuminate \Database \Query \Builder ;
7
8
8
9
trait Cachable
9
10
{
@@ -46,7 +47,11 @@ protected function makeCacheKey(
46
47
$ idColumn = null ,
47
48
string $ keyDifferentiator = ''
48
49
) : string {
49
- return (new CacheKey ($ this ->eagerLoad , $ this ->model , $ this ->query ))
50
+ $ eagerLoad = $ this ->eagerLoad ?? [];
51
+ $ model = $ this ->model ?? $ this ;
52
+ $ query = $ this ->query ?? app (Builder::class);
53
+
54
+ return (new CacheKey ($ eagerLoad , $ model , $ query ))
50
55
->make ($ columns , $ idColumn , $ keyDifferentiator );
51
56
}
52
57
You can’t perform that action at this time.
0 commit comments