Bez popisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RouteServiceProvider.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Providers;
  3. use Illuminate\Cache\RateLimiting\Limit;
  4. use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
  5. use Illuminate\Http\Request;
  6. use Illuminate\Support\Facades\RateLimiter;
  7. use Illuminate\Support\Facades\Route;
  8. class RouteServiceProvider extends ServiceProvider
  9. {
  10. /**
  11. * The path to your application's "home" route.
  12. *
  13. * Typically, users are redirected here after authentication.
  14. *
  15. * @var string
  16. */
  17. public const HOME = '/home';
  18. /**
  19. * Define your route model bindings, pattern filters, and other route configuration.
  20. */
  21. public function boot(): void
  22. {
  23. RateLimiter::for('api', function (Request $request) {
  24. return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
  25. });
  26. $this->routes(function () {
  27. Route::middleware('api')
  28. ->prefix('api')
  29. ->group(base_path('routes/api.php'));
  30. Route::middleware('web')
  31. ->group(base_path('routes/web.php'));
  32. });
  33. }
  34. }