app.php 949 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. use App\Http\Middleware\AssignTraceId;
  3. use App\Http\Middleware\HandleInertiaRequests;
  4. use Illuminate\Foundation\Application;
  5. use Illuminate\Foundation\Configuration\Exceptions;
  6. use Illuminate\Foundation\Configuration\Middleware;
  7. use Sentry\Laravel\Integration;
  8. return Application::configure(basePath: dirname(__DIR__))
  9. ->withRouting(
  10. web: __DIR__.'/../routes/web.php',
  11. commands: __DIR__.'/../routes/console.php',
  12. channels: __DIR__.'/../routes/channels.php',
  13. health: '/up',
  14. )
  15. ->withMiddleware(function (Middleware $middleware) {
  16. $middleware->statefulApi();
  17. $middleware->append(AssignTraceId::class);
  18. $middleware->web(append: [
  19. HandleInertiaRequests::class,
  20. ]);
  21. })
  22. ->withExceptions(function (Exceptions $exceptions) {
  23. if(config('app.sentry_is_enabled', false)) {
  24. Integration::handles($exceptions);
  25. }
  26. })->create();