30 lines
751 B
PHP
30 lines
751 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Cache\RateLimiting\Limit;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\RateLimiter;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// Rate limiter delle rotte pubbliche (gruppo `throttle:public` in routes/api.php).
|
|
// Nessun utente loggato → si limita per IP. Tarare il numero sul traffico reale.
|
|
RateLimiter::for('public', fn (Request $request) => Limit::perMinute(60)->by($request->ip()));
|
|
}
|
|
}
|