File tree Expand file tree Collapse file tree 3 files changed +998
-5
lines changed Expand file tree Collapse file tree 3 files changed +998
-5
lines changed Original file line number Diff line number Diff line change @@ -113,4 +113,9 @@ public static function getTreeLabelAttribute(): string
113113 {
114114 return 'label ' ;
115115 }
116+
117+ public function getScopeAttributes (): array
118+ {
119+ return ['menu_id ' ];
120+ }
116121}
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public function mount(): void
2929 parent ::mount ();
3030
3131 $ menuModelClass = MenuResource::getModel ();
32- $ recordId = request ()-> route ( ' record ' );
32+ $ recordId = static :: getMenuRecordId ( );
3333 $ this ->record = app ($ menuModelClass )->findOrFail ($ recordId );
3434 }
3535
@@ -47,14 +47,15 @@ public static function route(string $path): PageRegistration
4747 );
4848 }
4949
50- public static function getModel (): string | QueryBuilder
50+ protected static function getMenuRecordId (): int
5151 {
52- return FilamentFlexibleContentBlockPages:: config ()->getMenuItemModel ( );
52+ return request ()->route ( ' record ' );
5353 }
5454
55- public function getTreeQuery ()
55+ public static function getModel (): string | QueryBuilder
5656 {
57- return static ::getModel ()::where ('menu_id ' , $ this ->record ->id );
57+ return FilamentFlexibleContentBlockPages::config ()->getMenuItemModel ()
58+ ::scoped (['menu_id ' => static ::getMenuRecordId ()]);
5859 }
5960
6061 public function getTitle (): string
You can’t perform that action at this time.
0 commit comments