Update RouteServiceProvider.php

This commit is contained in:
Ralph J. Smit
2022-07-01 12:01:33 +02:00
parent 34b838c259
commit ec45b0dac0

View File

@@ -31,13 +31,14 @@ class RouteServiceProvider extends ServiceProvider
* *
* @return void * @return void
*/ */
public function boot() public function boot(): void
{ {
$this->configureRateLimiting(); $this->configureRateLimiting();
$this->routes(function () { $this->routes(function () {
// The settings('enable_api') is now handled by the GlobalApiAuthenticated middleware, // The settings('enable_api') is now handled by the GlobalApiAuthenticated middleware,
// because the conditional inside this service makes testing very hard. // because the conditional inside this service makes testing very hard. This doesn't
// matter for existing users, because now the middleware will return 404 responses.
Route::prefix('api') Route::prefix('api')
->middleware(['api', 'global.api.authenticated']) ->middleware(['api', 'global.api.authenticated'])
->namespace($this->namespace . '\Api') ->namespace($this->namespace . '\Api')
@@ -61,7 +62,7 @@ class RouteServiceProvider extends ServiceProvider
* *
* @return void * @return void
*/ */
protected function configureRateLimiting() protected function configureRateLimiting(): void
{ {
RateLimiter::for('api', function (Request $request) { RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60); return Limit::perMinute(60);