File tree Expand file tree Collapse file tree
SectionResource/RelationManagers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ class PageResource extends Resource
4343
4444 protected static ?string $ navigationGroup = 'CMS ' ;
4545
46- protected static bool $ shouldRegisterNavigation = true ;
46+ protected static bool $ shouldRegisterNavigation = false ;
4747
4848 protected static ?string $ navigationLabel = 'Pages ' ;
4949
@@ -165,10 +165,6 @@ public static function form(Form $form): Form
165165 public static function table (Table $ table ): Table
166166 {
167167 return $ table
168- ->modifyQueryUsing (fn (Builder $ query ) => $ query ->when (
169- request ()->get ('sId ' ),
170- fn (Builder $ q , $ sId ) => $ q ->where ('section_id ' , $ sId )
171- ))
172168 ->columns ([
173169 TextColumn::make ('title ' )
174170 ->label ('Page Title ' )
@@ -186,7 +182,8 @@ public static function table(Table $table): Table
186182 ->label ('Section ' )
187183 ->sortable ()
188184 ->badge ()
189- ->color ('gray ' ),
185+ ->color ('gray ' )
186+ ->hidden (fn () => request ()->has ('sId ' )),
190187
191188 TextColumn::make ('sef_key ' )
192189 ->label ('URL Slug ' )
Original file line number Diff line number Diff line change 33namespace Eclipse \Cms \Admin \Filament \Resources \PageResource \Pages ;
44
55use Eclipse \Cms \Admin \Filament \Resources \PageResource ;
6+ use Eclipse \Cms \Models \Section ;
67use Eclipse \Common \Foundation \Pages \HasScoutSearch ;
78use Filament \Actions \CreateAction ;
89use Filament \Resources \Pages \ListRecords ;
10+ use Illuminate \Database \Eloquent \Builder ;
911
1012class ListPages extends ListRecords
1113{
1214 use HasScoutSearch;
1315
1416 protected static string $ resource = PageResource::class;
1517
18+ public function getTitle (): string
19+ {
20+ if ($ sectionId = request ()->get ('sId ' )) {
21+ $ section = Section::find ($ sectionId );
22+ if ($ section ) {
23+ return $ section ->name ;
24+ }
25+ }
26+
27+ return parent ::getTitle ();
28+ }
29+
30+ public function getBreadcrumb (): ?string
31+ {
32+ if ($ sectionId = request ()->get ('sId ' )) {
33+ $ section = Section::find ($ sectionId );
34+ if ($ section ) {
35+ return $ section ->name ;
36+ }
37+ }
38+
39+ return parent ::getBreadcrumb ();
40+ }
41+
42+ protected function getTableQuery (): Builder
43+ {
44+ $ query = parent ::getTableQuery ();
45+
46+ if ($ sectionId = request ()->get ('sId ' )) {
47+ $ query ->where ('section_id ' , $ sectionId );
48+ }
49+
50+ return $ query ;
51+ }
52+
1653 protected function getHeaderActions (): array
1754 {
1855 $ createAction = CreateAction::make ();
Original file line number Diff line number Diff line change 33namespace Eclipse \Cms \Admin \Filament \Resources ;
44
55use Eclipse \Cms \Admin \Filament \Resources \SectionResource \Pages ;
6- use Eclipse \Cms \Admin \Filament \Resources \SectionResource \RelationManagers ;
76use Eclipse \Cms \Enums \SectionType ;
87use Eclipse \Cms \Models \Section ;
98use Filament \Forms \Components \Placeholder ;
@@ -44,6 +43,8 @@ class SectionResource extends Resource
4443
4544 protected static ?string $ navigationLabel = 'Sections ' ;
4645
46+ protected static ?int $ navigationSort = 20 ;
47+
4748 public static function form (Form $ form ): Form
4849 {
4950 return $ form
@@ -143,9 +144,7 @@ public static function table(Table $table): Table
143144
144145 public static function getRelations (): array
145146 {
146- return [
147- RelationManagers \PagesRelationManager::class,
148- ];
147+ return [];
149148 }
150149
151150 public static function getPages (): array
Load diff This file was deleted.
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public function getSectionNavigationItems(): array
3131 'sId ' => $ section ->id ,
3232 ])
3333 )
34- ->icon ('heroicon-o-arrow-turn-down-right ' )
34+ ->icon ('heroicon-o-document-text ' )
3535 ->group ('CMS ' )
3636 ->sort (10 )
3737 ->visible (fn (): bool => $ section ->{config ('eclipse-cms.tenancy.foreign_key ' )} === Filament::getTenant ()?->id)
You can’t perform that action at this time.
0 commit comments