app.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. use Illuminate\Foundation\Application;
  3. use Illuminate\Foundation\Configuration\Exceptions;
  4. use Illuminate\Foundation\Configuration\Middleware;
  5. use Illuminate\Console\Scheduling\Schedule;
  6. use App\Http\Middleware\SetUserLanguage;
  7. use App\Http\Middleware\CheckPermission;
  8. use Laravel\Sanctum\Http\Middleware\CheckForAnyAbility;
  9. use App\Tasks\DeleteExpiredTokens;
  10. return Application::configure(basePath: dirname(__DIR__))
  11. ->withRouting(
  12. web: __DIR__.'/../routes/web.php',
  13. api: __DIR__.'/../routes/api.php',
  14. commands: __DIR__.'/../routes/console.php',
  15. health: '/up',
  16. )
  17. ->withMiddleware(function (Middleware $middleware) {
  18. // $middleware->statefulApi();
  19. $middleware->append(SetUserLanguage::class);
  20. $middleware->alias([
  21. 'permission' => CheckPermission::class,
  22. 'ability' => CheckForAnyAbility::class,
  23. ]);
  24. })
  25. ->withSchedule(function (Schedule $schedule) {
  26. $schedule->call(new DeleteExpiredTokens)->everyMinute();
  27. })
  28. ->withExceptions(function (Exceptions $exceptions) {
  29. //
  30. })
  31. ->create();