AppPanelProvider.php
TLDR
This file is the AppPanelProvider
class under the App\Providers\Filament
namespace. It extends the PanelProvider
class and is used to configure an application panel in the Filament admin interface. The panel
method is used to define the configuration of the panel, including its ID, path, authentication, middleware, and resource/page/widget discovery.
Methods
panel
This method is used to configure the application panel. It takes a Panel
object as a parameter and returns the updated Panel
object. The method chains several configuration methods on the Panel
object to define its ID, path, authentication, middleware, and resource/page/widget discovery. The configured Panel
object is then returned.
Classes
None
<?php
namespace App\Providers\Filament;
use App\Filament\App\Pages\RegisterTeam;
use App\Filament\Pages\Auth\Login;
use App\Models\Team;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Panel;
use Filament\PanelProvider;
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
->id('app')
->path('app')
->login(Login::class)
->registration()
->passwordReset()
->emailVerification()
->tenant(Team::class)
->tenantRegistration(RegisterTeam::class)
->discoverResources(in: app_path('Filament/App/Resources'), for: 'App\\Filament\\App\\Resources')
->discoverPages(in: app_path('Filament/App/Pages'), for: 'App\\Filament\\App\\Pages')
->discoverWidgets(in: app_path('Filament/App/Widgets'), for: 'App\\Filament\\App\\Widgets')
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
}
}