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
113
113
{
114
114
return 'label ' ;
115
115
}
116
+
117
+ public function getScopeAttributes (): array
118
+ {
119
+ return ['menu_id ' ];
120
+ }
116
121
}
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 = request ()-> route ( ' record ' );
32
+ $ recordId = static :: getMenuRecordId ( );
33
33
$ this ->record = app ($ menuModelClass )->findOrFail ($ recordId );
34
34
}
35
35
@@ -47,14 +47,15 @@ public static function route(string $path): PageRegistration
47
47
);
48
48
}
49
49
50
- public static function getModel (): string | QueryBuilder
50
+ protected static function getMenuRecordId (): int
51
51
{
52
- return FilamentFlexibleContentBlockPages:: config ()->getMenuItemModel ( );
52
+ return request ()->route ( ' record ' );
53
53
}
54
54
55
- public function getTreeQuery ()
55
+ public static function getModel (): string | QueryBuilder
56
56
{
57
- return static ::getModel ()::where ('menu_id ' , $ this ->record ->id );
57
+ return FilamentFlexibleContentBlockPages::config ()->getMenuItemModel ()
58
+ ::scoped (['menu_id ' => static ::getMenuRecordId ()]);
58
59
}
59
60
60
61
public function getTitle (): string
You can’t perform that action at this time.
0 commit comments