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
29
29
parent ::mount ();
30
30
31
31
$ menuModelClass = MenuResource::getModel ();
32
- $ recordId = static :: getMenuRecordId ( );
32
+ $ recordId = request ()-> route ( ' record ' );
33
33
$ this ->record = app ($ menuModelClass )->findOrFail ($ recordId );
34
34
}
35
35
@@ -47,15 +47,19 @@ public static function route(string $path): PageRegistration
47
47
);
48
48
}
49
49
50
- protected static function getMenuRecordId (): int
50
+ public static function getModel (): string | QueryBuilder
51
51
{
52
- return request ()->route ( ' record ' ) ;
52
+ return FilamentFlexibleContentBlockPages:: config ()->getMenuItemModel ()::class ;
53
53
}
54
54
55
- public static function getModel (): string | QueryBuilder
55
+ protected function getViewData (): array
56
56
{
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
+ ];
59
63
}
60
64
61
65
public function getTitle (): string
You can’t perform that action at this time.
0 commit comments