Register static middleware group

This commit is contained in:
Shift
2026-01-15 13:17:57 +00:00
parent 4e8c7e9395
commit 15e28c2a21
2 changed files with 22 additions and 0 deletions
+10
View File
@@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
@@ -16,6 +17,10 @@ return Application::configure(basePath: dirname(__DIR__))
commands: __DIR__.'/../routes/console.php',
channels: __DIR__.'/../routes/channels.php',
health: '/up',
then: function () {
Route::middleware('static')
->group(base_path('routes/static.php'));
},
)
->withMiddleware(function (Middleware $middleware) {
$middleware->redirectGuestsTo(fn () => route('login'));
@@ -63,6 +68,11 @@ return Application::configure(basePath: dirname(__DIR__))
'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middleware\RoleOrPermissionMiddleware::class,
]);
$middleware->group('static', [
\App\Http\Middleware\SetCacheControlHeader::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
]);
})
->withExceptions(function (Exceptions $exceptions) {
\Sentry\Laravel\Integration::handles($exceptions);
+12
View File
@@ -0,0 +1,12 @@
<?php
/*
|--------------------------------------------------------------------------
| Static Routes
|--------------------------------------------------------------------------
|
| Here you may register the cacheable routes for your application.
| These routes are loaded within the "static" middleware group
| which adds the appropriate headers to cache the response.
|
*/