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-05 21:15:17 +02:00
|
|
|
$e instanceof Error => \App\Enums\LogLevelEnum::CRITICAL,
|
|
|
|
|
$e instanceof RuntimeException => \App\Enums\LogLevelEnum::ERROR,
|
|
|
|
|
$e instanceof InvalidArgumentException => \App\Enums\LogLevelEnum::WARNING,
|
|
|
|
|
default => \App\Enums\LogLevelEnum::ERROR,
|
2025-06-29 18:33:18 +02:00
|
|
|
};
|
2025-08-05 21:15:17 +02:00
|
|
|
|
2025-06-29 18:33:18 +02:00
|
|
|
App\Events\ExceptionOccurred::dispatch(
|
|
|
|
|
$e,
|
|
|
|
|
$level,
|
|
|
|
|
$e->getMessage(),
|
|
|
|
|
[]
|
|
|
|
|
);
|
|
|
|
|
});
|
2025-06-29 08:50:03 +02:00
|
|
|
})->create();
|