File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Expand file tree Collapse file tree 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
7373 protected function getWhereClauses () : string
7474 {
7575 return collect ($ this ->query ->wheres )->reduce (function ($ carry , $ where ) {
76- $ value = $ where ['value ' ] ?? implode ('_ ' , $ where ['values ' ]) ?? '' ;
76+ $ value = $ where ['value ' ] ?? implode ('_ ' , ( $ where ['values ' ] ?? [])) ;
7777
7878 return "{$ carry }- {$ where ['column ' ]}_ {$ value }" ;
7979 }) ?: '' ;
@@ -93,13 +93,21 @@ protected function getWithModels() : string
9393 protected function getCacheTags () : array
9494 {
9595 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 ));
103111 })
104112 ->prepend (str_slug (get_class ($ this ->model )))
105113 ->values ()
You can’t perform that action at this time.
0 commit comments