Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
1.9 KiB
PHP
Raw Permalink Normal View History

2018-05-09 08:05:17 -05:00
<?php
namespace App\Providers;
2020-11-03 17:18:31 +01:00
use Illuminate\Cache\RateLimiting\Limit;
2018-05-09 08:05:17 -05:00
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
2020-11-03 17:18:31 +01:00
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
2018-05-09 08:05:17 -05:00
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
2020-11-03 17:18:31 +01:00
* The path to the "home" route for your application.
2018-05-09 08:05:17 -05:00
*
2020-11-03 17:18:31 +01:00
* This is used by Laravel authentication to redirect users after login.
2018-05-09 08:05:17 -05:00
*
* @var string
*/
2020-11-03 17:18:31 +01:00
public const HOME = '/';
2018-05-09 08:05:17 -05:00
2020-05-23 19:05:18 +02:00
/**
2020-11-03 17:18:31 +01:00
* The controller namespace for the application.
2020-05-23 19:05:18 +02:00
*
2020-11-03 17:18:31 +01:00
* When present, controller route declarations will automatically be prefixed with this namespace.
*
* @var string|null
2020-05-23 19:05:18 +02:00
*/
2020-11-03 17:18:31 +01:00
protected $namespace = 'App\\Http\\Controllers';
2020-05-23 19:05:18 +02:00
2018-05-09 08:05:17 -05:00
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
2020-11-03 17:18:31 +01:00
//$this->configureRateLimiting();
2018-05-09 08:05:17 -05:00
2020-11-03 17:18:31 +01:00
$this->routes(function () {
2018-05-09 08:05:17 -05:00
2020-11-03 17:18:31 +01:00
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*/
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
2018-05-09 08:05:17 -05:00
2020-11-03 17:18:31 +01:00
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*/
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
2018-05-09 08:05:17 -05:00
}
/**
2020-11-03 17:18:31 +01:00
* Configure the rate limiters for the application.
2018-05-09 08:05:17 -05:00
*
* @return void
*/
2020-11-03 17:18:31 +01:00
protected function configureRateLimiting()
2018-05-09 08:05:17 -05:00
{
2020-11-03 17:18:31 +01:00
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60);
});
2018-05-09 08:05:17 -05:00
}
}