2015-06-01 15:43:37 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
2014-08-11 10:13:20 -05:00
|
|
|
|
2020-08-27 13:36:32 -05:00
|
|
|
use Illuminate\Cache\RateLimiting\Limit;
|
2014-09-30 21:13:58 -05:00
|
|
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
2020-08-27 13:36:32 -05:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\RateLimiter;
|
2019-09-10 17:26:00 +02:00
|
|
|
use Illuminate\Support\Facades\Route;
|
2014-08-11 10:13:20 -05:00
|
|
|
|
2015-02-22 20:47:03 -06:00
|
|
|
class RouteServiceProvider extends ServiceProvider
|
|
|
|
{
|
2019-12-10 08:59:27 -06:00
|
|
|
/**
|
2023-04-11 17:17:21 -05:00
|
|
|
* The path to your application's "home" route.
|
2019-12-10 08:59:27 -06:00
|
|
|
*
|
2022-05-05 14:52:23 -05:00
|
|
|
* Typically, users are redirected here after authentication.
|
2020-06-24 12:47:56 -05:00
|
|
|
*
|
2019-12-10 08:59:27 -06:00
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public const HOME = '/home';
|
|
|
|
|
2015-02-22 20:47:03 -06:00
|
|
|
/**
|
2022-05-05 14:52:23 -05:00
|
|
|
* Define your route model bindings, pattern filters, and other route configuration.
|
2015-02-22 20:47:03 -06:00
|
|
|
*/
|
2023-01-03 09:35:24 +00:00
|
|
|
public function boot(): void
|
2015-02-22 20:47:03 -06:00
|
|
|
{
|
2023-04-15 16:53:39 -05:00
|
|
|
RateLimiter::for('api', function (Request $request) {
|
|
|
|
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
|
|
|
});
|
2020-08-27 13:36:32 -05:00
|
|
|
|
2020-07-14 14:00:47 -05:00
|
|
|
$this->routes(function () {
|
2022-04-11 17:07:05 +03:00
|
|
|
Route::middleware('api')
|
|
|
|
->prefix('api')
|
2020-07-14 14:00:47 -05:00
|
|
|
->group(base_path('routes/api.php'));
|
2020-09-11 08:29:38 -05:00
|
|
|
|
|
|
|
Route::middleware('web')
|
|
|
|
->group(base_path('routes/web.php'));
|
2020-07-14 14:00:47 -05:00
|
|
|
});
|
2015-02-22 20:47:03 -06:00
|
|
|
}
|
2014-09-15 09:12:48 -03:00
|
|
|
}
|