fedi-feed-router/backend/bootstrap/app.php

43 lines
1.6 KiB
PHP
Raw Permalink Normal View History

2025-06-29 08:50:03 +02:00
<?php
use App\Http\Middleware\HandleAppearance;
use App\Http\Middleware\HandleInertiaRequests;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
2025-08-02 15:20:09 +02:00
api: __DIR__.'/../routes/api.php',
2025-06-29 08:50:03 +02:00
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
$middleware->encryptCookies(except: ['appearance', 'sidebar_state']);
$middleware->web(append: [
HandleAppearance::class,
HandleInertiaRequests::class,
AddLinkHeadersForPreloadedAssets::class,
]);
})
->withExceptions(function (Exceptions $exceptions) {
2025-06-29 18:33:18 +02:00
$exceptions->reportable(function (Throwable $e) {
$level = match (true) {
2025-08-15 16:39:18 +02:00
$e instanceof Error => \Domains\Logging\Enums\LogLevelEnum::CRITICAL,
$e instanceof RuntimeException => \Domains\Logging\Enums\LogLevelEnum::ERROR,
$e instanceof InvalidArgumentException => \Domains\Logging\Enums\LogLevelEnum::WARNING,
default => \Domains\Logging\Enums\LogLevelEnum::ERROR,
2025-06-29 18:33:18 +02:00
};
2025-08-05 21:15:17 +02:00
2025-08-15 16:39:18 +02:00
Domains\Logging\Events\ExceptionOccurred::dispatch(
2025-06-29 18:33:18 +02:00
$e,
$level,
$e->getMessage(),
[]
);
});
2025-06-29 08:50:03 +02:00
})->create();