diff --git a/src/Report.php b/src/Report.php index d4bed18..e13a318 100644 --- a/src/Report.php +++ b/src/Report.php @@ -42,7 +42,8 @@ class Report extends Page implements HasActionsPanel, HasBody, HasFooter, HasFor public int $sort = 0; - public function getSort(): int { + public function getSort(): int + { return $this->sort; } diff --git a/src/ReportsPlugin.php b/src/ReportsPlugin.php index 3ba536a..617c3d4 100644 --- a/src/ReportsPlugin.php +++ b/src/ReportsPlugin.php @@ -32,7 +32,7 @@ public function boot(Panel $panel): void { if (! reports()->getUseReportListPage()) { - // get reports with + // get reports with $panel->navigationGroups([ NavigationGroup::make() ->label(reports()->getNavigationLabel() ?? __('filament-reports::menu-page.nav.group')) @@ -40,19 +40,20 @@ public function boot(Panel $panel): void ]); $panel->navigationItems(collect(reports()->getReports())->map(function ($report) { $report = app($report); + return NavigationItem::make($report->getHeading()) ->url(function () use ($report) { return $report->getUrl(); }) ->parentItem(get_class($report)::getNavigationParentItem() ?? reports()->getNavigationParentItem()) ->label(get_class($report)::getNavigationLabel() ?? $report->getHeading()) - ->sort(get_class($report)::getNavigationSort() ?? $report->getSort() ?? 0) + ->sort(get_class($report)::getNavigationSort() ?? $report->getSort() ?? 0) ->badge( get_class($report)::getNavigationBadge(), get_class($report)::getNavigationBadgeColor() - ) + ) ->icon(get_class($report)::getNavigationIcon() ?? $report->getIcon() ?? 'heroicon-o-document-text') - ->group(get_class($report)::getNavigationGroup() ?? reports()->getNavigationGroup() ?? __('filament-reports::menu-page.nav.group')); + ->group(get_class($report)::getNavigationGroup() ?? reports()->getNavigationGroup() ?? __('filament-reports::menu-page.nav.group')); })->toArray()); } }