## Summary - move the Laravel application into `apps/platform` and keep the repository root for orchestration, docs, and tooling - update the local command model, Sail/Docker wiring, runtime paths, and ignore rules around the new platform location - add relocation quickstart/contracts plus focused smoke coverage for bootstrap, command model, routes, and runtime behavior ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/PlatformRelocation` - integrated browser smoke validated `/up`, `/`, `/admin`, `/admin/choose-workspace`, and tenant route semantics for `200`, `403`, and `404` ## Remaining Rollout Checks - validate Dokploy build context and working-directory assumptions against the new `apps/platform` layout - confirm web, queue, and scheduler processes all start from the expected working directory in staging/production - verify no legacy volume mounts or asset-publish paths still point at the old root-level `public/` or `storage/` locations Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #213
127 lines
4.9 KiB
PHP
127 lines
4.9 KiB
PHP
<?php
|
|
|
|
namespace App\Providers\Filament;
|
|
|
|
use App\Filament\Pages\Auth\Login;
|
|
use App\Filament\Pages\TenantDashboard;
|
|
use App\Filament\Resources\TenantReviewResource;
|
|
use App\Models\Tenant;
|
|
use App\Support\Filament\PanelThemeAsset;
|
|
use App\Support\Middleware\DenyNonMemberTenantAccess;
|
|
use App\Support\OperationRunLinks;
|
|
use Filament\Facades\Filament;
|
|
use Filament\Http\Middleware\Authenticate;
|
|
use Filament\Http\Middleware\AuthenticateSession;
|
|
use Filament\Http\Middleware\DisableBladeIconComponents;
|
|
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
|
use Filament\Navigation\NavigationItem;
|
|
use Filament\Panel;
|
|
use Filament\PanelProvider;
|
|
use Filament\Support\Colors\Color;
|
|
use Filament\View\PanelsRenderHook;
|
|
use Filament\Widgets\AccountWidget;
|
|
use Filament\Widgets\FilamentInfoWidget;
|
|
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 TenantPanelProvider extends PanelProvider
|
|
{
|
|
public function panel(Panel $panel): Panel
|
|
{
|
|
$panel = $panel
|
|
->id('tenant')
|
|
->path('admin/t')
|
|
->login(Login::class)
|
|
->brandName('TenantPilot')
|
|
->brandLogo(fn () => view('filament.admin.logo'))
|
|
->brandLogoHeight('2rem')
|
|
->favicon(asset('favicon.ico'))
|
|
->tenant(Tenant::class, slugAttribute: 'external_id')
|
|
->tenantRoutePrefix(null)
|
|
->tenantMenu(fn (): bool => filled(Filament::getTenant()))
|
|
->searchableTenantMenu()
|
|
->colors([
|
|
'primary' => Color::Indigo,
|
|
])
|
|
->navigationItems([
|
|
NavigationItem::make(OperationRunLinks::collectionLabel())
|
|
->url(fn (): string => route('admin.operations.index'))
|
|
->icon('heroicon-o-queue-list')
|
|
->group('Monitoring')
|
|
->sort(10),
|
|
NavigationItem::make('Alerts')
|
|
->url(fn (): string => url('/admin/alerts'))
|
|
->icon('heroicon-o-bell-alert')
|
|
->group('Monitoring')
|
|
->sort(20),
|
|
NavigationItem::make('Audit Log')
|
|
->url(fn (): string => route('admin.monitoring.audit-log'))
|
|
->icon('heroicon-o-clipboard-document-list')
|
|
->group('Monitoring')
|
|
->sort(30),
|
|
])
|
|
->renderHook(
|
|
PanelsRenderHook::HEAD_END,
|
|
fn () => view('filament.partials.livewire-intercept-shim')->render()
|
|
)
|
|
->renderHook(
|
|
PanelsRenderHook::TOPBAR_START,
|
|
fn () => view('filament.partials.context-bar')->render()
|
|
)
|
|
->renderHook(
|
|
PanelsRenderHook::BODY_END,
|
|
fn () => (bool) config('tenantpilot.bulk_operations.progress_widget_enabled', true)
|
|
? view('livewire.bulk-operation-progress-wrapper')->render()
|
|
: ''
|
|
)
|
|
->discoverClusters(in: app_path('Filament/Clusters'), for: 'App\Filament\Clusters')
|
|
->resources([
|
|
TenantReviewResource::class,
|
|
])
|
|
->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources')
|
|
->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages')
|
|
->pages([
|
|
TenantDashboard::class,
|
|
])
|
|
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\Filament\Widgets')
|
|
->widgets([
|
|
AccountWidget::class,
|
|
FilamentInfoWidget::class,
|
|
])
|
|
->databaseNotifications()
|
|
->databaseNotificationsPolling('30s')
|
|
->middleware([
|
|
EncryptCookies::class,
|
|
AddQueuedCookiesToResponse::class,
|
|
StartSession::class,
|
|
AuthenticateSession::class,
|
|
ShareErrorsFromSession::class,
|
|
VerifyCsrfToken::class,
|
|
SubstituteBindings::class,
|
|
'ensure-correct-guard:web',
|
|
'ensure-workspace-selected',
|
|
'ensure-filament-tenant-selected',
|
|
DenyNonMemberTenantAccess::class,
|
|
DisableBladeIconComponents::class,
|
|
DispatchServingFilamentEvent::class,
|
|
])
|
|
->authMiddleware([
|
|
Authenticate::class,
|
|
]);
|
|
|
|
if (! app()->runningUnitTests()) {
|
|
$theme = PanelThemeAsset::resolve('resources/css/filament/admin/theme.css');
|
|
|
|
if (is_string($theme)) {
|
|
$panel->theme($theme);
|
|
}
|
|
}
|
|
|
|
return $panel;
|
|
}
|
|
}
|