Skip to content

Instantly share code, notes, and snippets.

@lucacastelnuovo
Last active August 18, 2023 12:23
Show Gist options
  • Save lucacastelnuovo/40926f5c50b44fd55105cffb22f7c29b to your computer and use it in GitHub Desktop.
Save lucacastelnuovo/40926f5c50b44fd55105cffb22f7c29b to your computer and use it in GitHub Desktop.
<?php
namespace App\Providers\Filament;
use App\Filament\AppPanel\Pages\Tenancy\EditTenantProfile;
use App\Filament\Pages\Auth\Login;
use App\Models\Tenant;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Pages;
use Filament\Pages\Page;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Widgets;
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\AuthenticateSession;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
class AppPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('app')
->path('app')
->profile()
->login(Login::class)
->passwordReset()
->favicon(asset('favicon.ico'))
->darkMode(false)
->discoverResources(
in: app_path('Filament/AppPanel/Resources'),
for: 'App\\Filament\\AppPanel\\Resources'
)
->discoverWidgets(
in: app_path('Filament/AppPanel/Widgets'),
for: 'App\\Filament\\AppPanel\\Widgets'
)
->widgets([
Widgets\AccountWidget::class,
])
->pages([
Pages\Dashboard::class,
])
->bootUsing(function () {
Page::formActionsAlignment('right');
})
->tenant(Tenant::class, slugAttribute: 'slug')
->tenantProfile(EditTenantProfile::class)
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment