File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 12
12
use Exception ;
13
13
use Illuminate \Contracts \Support \Arrayable ;
14
14
use Illuminate \Database \Eloquent \Collection ;
15
+ use Illuminate \Database \Eloquent \Relations \Relation ;
15
16
use Illuminate \Support \Str ;
16
17
17
18
/**
@@ -119,6 +120,16 @@ private static function getNestedBlocksForData(
119
120
120
121
$ block ->setRelation ('children ' , self ::getChildren ($ children ));
121
122
123
+ foreach ($ data ['browsers ' ] as $ browserName => $ browserItems ) {
124
+ $ browserData = collect ();
125
+ foreach ($ browserItems as $ browserItem ) {
126
+ $ className = Relation::getMorphedModel ($ browserItem ['endpointType ' ]) ?? $ browserItem ['endpointType ' ];
127
+ $ browserData ->push ((new $ className ())->find ($ browserItem ['id ' ]));
128
+ }
129
+
130
+ $ block ->setRelatedCache ($ browserName , $ browserData );
131
+ }
132
+
122
133
$ block ->medias = self ::getMedias ($ data );
123
134
124
135
$ class ->setRenderData (
Original file line number Diff line number Diff line change @@ -125,4 +125,9 @@ public function clearAllRelated(): void
125
125
{
126
126
$ this ->relatedItems ()->delete ();
127
127
}
128
+
129
+ public function setRelatedCache ($ browser , $ items ): void
130
+ {
131
+ $ this ->relatedCache [$ browser ] = $ items ;
132
+ }
128
133
}
You can’t perform that action at this time.
0 commit comments