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