File tree 1 file changed +16
-8
lines changed
1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ protected function getQueryColumns(array $columns) : string
73
73
protected function getWhereClauses () : string
74
74
{
75
75
return collect ($ this ->query ->wheres )->reduce (function ($ carry , $ where ) {
76
- $ value = $ where ['value ' ] ?? implode ('_ ' , $ where ['values ' ]) ?? '' ;
76
+ $ value = $ where ['value ' ] ?? implode ('_ ' , ( $ where ['values ' ] ?? [])) ;
77
77
78
78
return "{$ carry }- {$ where ['column ' ]}_ {$ value }" ;
79
79
}) ?: '' ;
@@ -93,13 +93,21 @@ protected function getWithModels() : string
93
93
protected function getCacheTags () : array
94
94
{
95
95
return collect ($ this ->eagerLoad )->keys ()
96
- ->map (function ($ name ) {
97
- return str_slug (get_class (
98
- $ this ->model
99
- ->{$ name }()
100
- ->getQuery ()
101
- ->model
102
- ));
96
+ ->map (function ($ relationName ) {
97
+ $ relation = collect (explode ('. ' , $ relationName ))
98
+ ->reduce (function ($ carry , $ name ) use ($ relationName ) {
99
+ if (! $ carry ) {
100
+ $ carry = $ this ->model ;
101
+ }
102
+
103
+ if ($ carry instanceof Relation) {
104
+ $ carry = $ carry ->getQuery ()->model ;
105
+ }
106
+
107
+ return $ carry ->{$ name }();
108
+ });
109
+
110
+ return str_slug (get_class ($ relation ->getQuery ()->model ));
103
111
})
104
112
->prepend (str_slug (get_class ($ this ->model )))
105
113
->values ()
You can’t perform that action at this time.
0 commit comments