setupNavigation(); $this->setupUserNavigation(); $this->setupUserSettings(); $this->setupAssets(); $this->setupFieldMacros(); } /** * Register the Nova routes. */ protected function routes(): void { Nova::routes() ->withAuthenticationRoutes() ->withPasswordResetRoutes() ->register(); } /** * Register the Nova gate. * * This gate determines who can access Nova in non-local environments. */ protected function gate(): void { Gate::define('viewNova', NovaRepo::viewNova()); } /** * Get the dashboards that should be listed in the Nova sidebar. */ protected function dashboards(): array { return [ new Main, ]; } /** * Get the tools that should be listed in the Nova sidebar. */ public function tools(): array { return [ LocaleSwitcher::make() ->setLocales(config('app.locales')) ->onSwitchLocale(NovaRepo::localeSwitcherSave()), BackupTool::make() ->canSee(NovaRepo::isSuperAdmin()), LogsTool::make() ->canSee(NovaRepo::isMe()) ->canDownload(NovaRepo::isMe()) ->canDelete(NovaRepo::isMe()), ]; } /** * Setup navigation */ public function setupNavigation(): void { Nova::mainMenu(fn (Request $request) => NovaMenuRepo::items($request)); } /** * Setup user navigation (dropdown). */ public function setupUserNavigation(): void { Nova::userMenu(function (Request $request, Menu $menu) { $menu->prepend(MenuItem::make(__('My Profile'), $request->user()->profilePage())); return $menu; }); } /** * Setup user settings */ public function setupUserSettings(): void { Nova::serving(fn (ServingNova $event) => NovaRepo::serving($event)); } /** * Setup Assets */ public function setupAssets(): void { Nova::style('additional', resource_path('css/vendor/nova/css/additional.css')); } /** * Setup macros of fields */ public function setupFieldMacros(): void { Date::macro('toTurkmenFormat', fn () => $this->displayUsing(fn ($value) => $value?->format('d.m.Y'))); DateTime::macro('turkmenDateTime', fn () => $this->displayUsing(fn ($value) => $value?->format('H:i, d.m.Y'))); } }