diff --git a/composer.json b/composer.json index 16c8b23..6a2ae5e 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "filament/filament": "^5.0|^4.0", "filament/spatie-laravel-media-library-plugin": "^5.0|^4.0", "illuminate/contracts": "^13.0||^12.0", - "maatwebsite/excel": "^3.1", + "maatwebsite/excel": "^4.0", "spatie/browsershot": "^5.0", "spatie/eloquent-sortable": "^5.0", "tapp/filament-form-builder": "^4.0" diff --git a/src/LmsPanelProvider.php b/src/LmsPanelProvider.php index 1939091..409205c 100644 --- a/src/LmsPanelProvider.php +++ b/src/LmsPanelProvider.php @@ -18,7 +18,7 @@ use Illuminate\Contracts\View\View; use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse; use Illuminate\Cookie\Middleware\EncryptCookies; -use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken; +use Illuminate\Foundation\Http\Middleware\PreventRequestForgery; use Illuminate\Routing\Middleware\SubstituteBindings; use Illuminate\Session\Middleware\AuthenticateSession; use Illuminate\Session\Middleware\StartSession; @@ -128,7 +128,7 @@ public function panel(Panel $panel): Panel StartSession::class, AuthenticateSession::class, ShareErrorsFromSession::class, - VerifyCsrfToken::class, + $this->csrfMiddleware(), SubstituteBindings::class, DisableBladeIconComponents::class, DispatchServingFilamentEvent::class, @@ -218,4 +218,13 @@ function () use ($hookedNavigationItems): View { ->url(fn (): string => Dashboard::getUrl()), ]); } + + private function csrfMiddleware(): string + { + if (class_exists(PreventRequestForgery::class)) { + return PreventRequestForgery::class; + } + + return 'Illuminate\Foundation\Http\Middleware\VerifyCsrfToken'; + } }