3 namespace App\Providers;
5 use Illuminate\Cache\RateLimiting\Limit;
6 use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
7 use Illuminate\Http\Request;
8 use Illuminate\Support\Facades\RateLimiter;
9 use Illuminate\Support\Facades\Route;
11 class RouteServiceProvider extends ServiceProvider
14 * The path to the "home" route for your application.
16 * This is used by Laravel authentication to redirect users after login.
20 public const HOME = '/home';
23 * Define your route model bindings, pattern filters, etc.
27 public function boot()
29 $this->configureRateLimiting();
31 $this->routes(function () {
34 ->group(base_path('routes/api.php'));
36 Route::middleware('web')
37 ->group(base_path('routes/web.php'));
42 * Configure the rate limiters for the application.
46 protected function configureRateLimiting()
48 RateLimiter::for('api', function (Request $request) {
49 return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());