withRouting( web: __DIR__.'/../routes/web.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware): void { $middleware->encryptCookies(except: ['appearance', 'sidebar_state']); // Stripe cannot send our form-protection token. Its messages are checked by signature instead. $middleware->validateCsrfTokens(except: ['stripe/webhook']); $middleware->web(append: [ HandleAppearance::class, HandleInertiaRequests::class, AddLinkHeadersForPreloadedAssets::class, ]); }) ->withExceptions(function (Exceptions $exceptions): void { $exceptions->shouldRenderJsonWhen( fn (Request $request) => $request->is('api/*') || $request->expectsJson(), ); })->create(); // Development settings live in .env.local (never uploaded to the repository). // When that file exists it is used instead of .env, which holds only basic, non-secret settings. if (is_file($app->environmentPath().'/.env.local')) { $app->loadEnvironmentFrom('.env.local'); } return $app;