File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 22
33namespace Statikbe \FilamentFlexibleContentBlockPages \Resources \PageResource \Pages ;
44
5+ use Illuminate \Database \Eloquent \Builder ;
56use Illuminate \Database \Eloquent \Model ;
67use SolutionForest \FilamentTree \Actions \EditAction ;
78use SolutionForest \FilamentTree \Actions \ViewAction ;
@@ -83,4 +84,18 @@ public function getTreeRecordIcon(?Model $record = null): ?string
8384
8485 return null ;
8586 }
87+
88+ /**
89+ * Overwritten to eager load parent relationship.
90+ * {@inheritDoc}
91+ */
92+ protected function getWithRelationQuery (): Builder
93+ {
94+ $ query = parent ::getWithRelationQuery ();
95+ if (method_exists ($ this ->getModel (), 'parent ' ) && $ this ->getModel ()::has ('parent ' )) {
96+ return $ query ->with ('parent ' );
97+ }
98+
99+ return $ query ;
100+ }
86101}
You can’t perform that action at this time.
0 commit comments