init
This commit is contained in:
232 files changed
+25416
No files matched your search
@@ -0,0 +1,33 @@
|
||||
<?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
|
||||
{
|
||||
RateLimiter::for('app_api', function (Request $request): Limit {
|
||||
return Limit::perMinute(120)->by($request->route('packageName').':'.$request->ip());
|
||||
});
|
||||
|
||||
RateLimiter::for('cafe-bazaar-sync', function (object $job): Limit {
|
||||
return Limit::perMinute(4)->by((string) $job->mobileAppId);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user