File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed 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 = static :: getMenuRecordId ( );
32+ $ recordId = request ()-> route ( ' record ' );
3333 $ this ->record = app ($ menuModelClass )->findOrFail ($ recordId );
3434 }
3535
@@ -47,15 +47,19 @@ public static function route(string $path): PageRegistration
4747 );
4848 }
4949
50- protected static function getMenuRecordId (): int
50+ public static function getModel (): string | QueryBuilder
5151 {
52- return request ()->route ( ' record ' ) ;
52+ return FilamentFlexibleContentBlockPages:: config ()->getMenuItemModel ()::class ;
5353 }
5454
55- public static function getModel (): string | QueryBuilder
55+ protected function getViewData (): array
5656 {
57- return FilamentFlexibleContentBlockPages::config ()->getMenuItemModel ()
58- ::scoped (['menu_id ' => static ::getMenuRecordId ()]);
57+ $ query = static ::getModel ()::scoped (['menu_id ' => $ this ->record ->id ])
58+ ->defaultOrder ();
59+
60+ return [
61+ 'tree ' => $ query ->get ()->toTree (),
62+ ];
5963 }
6064
6165 public function getTitle (): string
You can’t perform that action at this time.
0 commit comments