Shift service providers

This commit is contained in:
Shift
2023-01-07 20:33:06 +00:00
parent cd9b2383a6
commit 2e6e296715
2 changed files with 25 additions and 16 deletions

View File

@@ -25,7 +25,6 @@ class EventServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
parent::boot();
// //
} }

View File

@@ -2,6 +2,9 @@
namespace App\Providers; namespace App\Providers;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Http\Request;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
@@ -30,24 +33,19 @@ class RouteServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
// $this->configureRateLimiting();
parent::boot();
}
/** $this->routes(function () {
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->mapApiRoutes(); $this->mapApiRoutes();
$this->mapWebRoutes(); $this->mapWebRoutes();
$this->mapInstallerRoutes(); $this->mapInstallerRoutes();
$this->mapUpdateRoutes(); $this->mapUpdateRoutes();
// //
});
} }
/** /**
* Define the "web" routes for the application. * Define the "web" routes for the application.
* *
@@ -117,4 +115,16 @@ class RouteServiceProvider extends ServiceProvider
require base_path('routes/update.php'); require base_path('routes/update.php');
}); });
} }
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
} }