Some checks failed
Main Confidence / confidence (push) Failing after 56s
## Summary - add the localization v1 foundation with request-time locale resolution and workspace or user preference handling - localize the first-wave platform surfaces for auth, shell, dashboards, findings, baseline compare, and review workspace chrome - add Pest coverage for locale resolution, preference flows, fallback behavior, notifications, and governance surface localization ## Scope - active spec: specs/252-platform-localization-v1 - target branch: dev ## Notes - machine-readable artifacts remain invariant and are not localized in this slice - the branch includes the related spec kit artifacts for the feature Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #293
85 lines
3.1 KiB
PHP
85 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace App\Providers\Filament;
|
|
|
|
use App\Filament\System\Pages\Auth\Login;
|
|
use App\Filament\System\Pages\Dashboard;
|
|
use App\Http\Middleware\UseSystemSessionCookie;
|
|
use App\Support\Auth\PlatformCapabilities;
|
|
use App\Support\Filament\PanelThemeAsset;
|
|
use Filament\FontProviders\LocalFontProvider;
|
|
use Filament\Http\Middleware\Authenticate;
|
|
use Filament\Http\Middleware\AuthenticateSession;
|
|
use Filament\Http\Middleware\DisableBladeIconComponents;
|
|
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
|
use Filament\Panel;
|
|
use Filament\PanelProvider;
|
|
use Filament\Support\Colors\Color;
|
|
use Filament\View\PanelsRenderHook;
|
|
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
|
use Illuminate\Cookie\Middleware\EncryptCookies;
|
|
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
|
use Illuminate\Routing\Middleware\SubstituteBindings;
|
|
use Illuminate\Session\Middleware\StartSession;
|
|
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
|
|
|
class SystemPanelProvider extends PanelProvider
|
|
{
|
|
public function panel(Panel $panel): Panel
|
|
{
|
|
$panel = $panel
|
|
->id('system')
|
|
->path('system')
|
|
->authGuard('platform')
|
|
->login(Login::class)
|
|
->font(null, provider: LocalFontProvider::class, preload: [])
|
|
->colors([
|
|
'primary' => Color::Blue,
|
|
])
|
|
->databaseNotifications(isLazy: false)
|
|
->databaseNotificationsPolling(null)
|
|
->renderHook(
|
|
PanelsRenderHook::BODY_START,
|
|
fn () => view('filament.system.components.break-glass-banner')->render(),
|
|
)
|
|
->renderHook(
|
|
PanelsRenderHook::TOPBAR_START,
|
|
fn () => view('filament.partials.locale-switcher', [
|
|
'plane' => 'system',
|
|
'showPreference' => false,
|
|
'embedded' => false,
|
|
])->render(),
|
|
)
|
|
->discoverPages(in: app_path('Filament/System/Pages'), for: 'App\\Filament\\System\\Pages')
|
|
->pages([
|
|
Dashboard::class,
|
|
])
|
|
->middleware([
|
|
EncryptCookies::class,
|
|
AddQueuedCookiesToResponse::class,
|
|
UseSystemSessionCookie::class,
|
|
StartSession::class,
|
|
AuthenticateSession::class,
|
|
ShareErrorsFromSession::class,
|
|
VerifyCsrfToken::class,
|
|
SubstituteBindings::class,
|
|
'ensure-correct-guard:platform',
|
|
DisableBladeIconComponents::class,
|
|
DispatchServingFilamentEvent::class,
|
|
])
|
|
->middleware(['apply-resolved-locale:system'], isPersistent: true)
|
|
->authMiddleware([
|
|
Authenticate::class,
|
|
'ensure-platform-capability:'.PlatformCapabilities::ACCESS_SYSTEM_PANEL,
|
|
]);
|
|
|
|
$theme = PanelThemeAsset::resolve('resources/css/filament/system/theme.css');
|
|
|
|
if (is_string($theme)) {
|
|
$panel->theme($theme);
|
|
}
|
|
|
|
return $panel;
|
|
}
|
|
}
|