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 = ['*'])
5555 $ class = get_called_class ();
5656 $ instance = new $ class ;
5757 $ tags = [str_slug (get_called_class ())];
58- $ key = makeCacheKey ();
58+ $ key = $ instance -> makeCacheKey ();
5959
6060 return $ instance ->cache ($ tags )
6161 ->rememberForever ($ key , function () use ($ columns ) {
Original file line number Diff line number Diff line change 44use GeneaLabs \LaravelModelCaching \CacheTags ;
55use GeneaLabs \LaravelModelCaching \CachedModel ;
66use Illuminate \Cache \TaggableStore ;
7+ use Illuminate \Database \Query \Builder ;
78
89trait Cachable
910{
@@ -46,7 +47,11 @@ protected function makeCacheKey(
4647 $ idColumn = null ,
4748 string $ keyDifferentiator = ''
4849 ) : 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 ))
5055 ->make ($ columns , $ idColumn , $ keyDifferentiator );
5156 }
5257
You can’t perform that action at this time.
0 commit comments