app.php 687 B

12345678910111213141516171819202122
  1. <?php
  2. use App\Http\Middleware\EnsureUserHasRole;
  3. use Illuminate\Foundation\Application;
  4. use Illuminate\Foundation\Configuration\Exceptions;
  5. use Illuminate\Foundation\Configuration\Middleware;
  6. return Application::configure(basePath: dirname(__DIR__))
  7. ->withRouting(
  8. web: __DIR__.'/../routes/web.php',
  9. commands: __DIR__.'/../routes/console.php',
  10. channels: __DIR__.'/../routes/channels.php',
  11. health: '/up',
  12. )
  13. ->withMiddleware(function (Middleware $middleware) {
  14. $middleware->alias([
  15. 'role' => EnsureUserHasRole::class,
  16. ]);
  17. })
  18. ->withExceptions(function (Exceptions $exceptions) {
  19. //
  20. })->create();