static::enableBreadcrumbs($request); } /** * Enable breadcrumb for incoming request * * @param NovaRequest $request */ public static function enableBreadcrumbs($request): bool { $data = $request->segments(); if (Route::currentRouteName() === 'nova.pages.detail' && count($data) === 4 && $data[2] === 'product-variants') { return false; } return true; } /** * Set locales */ public static function setLocale(ServingNova $event): void { $user = $event->request->user(); if ($user && array_key_exists($user->locale, config('app.locales'))) { app()->setLocale($user->locale); } } /** * Locale Switcher Save */ public static function localeSwitcherSave(): Closure { return function (Request $request) { $locale = $request->post('locale'); if (is_string($locale) && array_key_exists($locale, config('app.locales'))) { $request->user()->update([ 'options' => json_encode([ 'locale' => $locale, ]), ]); } }; } /** * Nova footer */ public static function footer(): Closure { return fn ($request) => view('vendor.nova.layouts.footer')->render(); } /** * Authorize user to view Nova */ public static function canViewNova(): Closure { return fn ($user) => $user->canAccessNova(); } /** * Nova raw image html */ public static function rawImage(string $url): string { return sprintf('', $url); } }