configureRateLimiting(); $this->routes(function () { Route::prefix('api') ->middleware('api') ->namespace($this->namespace) ->group(base_path('routes/api.php')); Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/web.php')); }); } /** * Configure the rate limiters for the application. * * @return void */ protected function configureRateLimiting() { RateLimiter::for('web', function (Request $request) { // @codeCoverageIgnoreStart return Limit::perMinute(25) ->by(optional($request->user())->id ?: app('clientIp')); // @codeCoverageIgnoreEnd }); // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass RateLimiter::for('api', function (Request $request) { return Limit::perMinute(config('api.apiRequestRatePerMinute', 100)) ->by(app('clientIp')); }); } }