2016-03-25 01:18:05 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2021-06-10 13:17:07 -07:00
|
|
|
use Illuminate\Cache\RateLimiting\Limit;
|
2016-03-25 01:18:05 -07:00
|
|
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
2021-06-10 13:19:27 -07:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\RateLimiter;
|
2019-03-13 20:12:03 -07:00
|
|
|
use Illuminate\Support\Facades\Route;
|
2016-03-25 01:18:05 -07:00
|
|
|
|
|
|
|
class RouteServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Define your route model bindings, pattern filters, etc.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2016-12-14 04:32:24 -08:00
|
|
|
public function boot()
|
2016-03-25 01:18:05 -07:00
|
|
|
{
|
2021-06-10 13:17:07 -07:00
|
|
|
$this->configureRateLimiting();
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2021-06-10 13:17:07 -07:00
|
|
|
$this->routes(function () {
|
|
|
|
$this->mapApiRoutes();
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2021-06-10 13:17:07 -07:00
|
|
|
$this->mapWebRoutes();
|
2016-12-14 04:32:24 -08:00
|
|
|
|
2022-03-04 14:00:00 -08:00
|
|
|
require base_path('routes/scim.php');
|
2021-06-10 13:17:07 -07:00
|
|
|
});
|
2016-12-14 04:32:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the "web" routes for the application.
|
|
|
|
*
|
|
|
|
* These routes all receive session state, CSRF protection, etc.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function mapWebRoutes()
|
|
|
|
{
|
|
|
|
Route::group([
|
|
|
|
'middleware' => 'web',
|
|
|
|
'namespace' => $this->namespace,
|
|
|
|
], function ($router) {
|
2016-12-15 04:12:18 -08:00
|
|
|
require base_path('routes/web/hardware.php');
|
2016-12-15 06:11:03 -08:00
|
|
|
require base_path('routes/web/models.php');
|
2016-12-15 04:12:18 -08:00
|
|
|
require base_path('routes/web/accessories.php');
|
|
|
|
require base_path('routes/web/licenses.php');
|
2016-12-15 04:27:17 -08:00
|
|
|
require base_path('routes/web/consumables.php');
|
2016-12-15 19:17:07 -08:00
|
|
|
require base_path('routes/web/fields.php');
|
2016-12-15 19:59:42 -08:00
|
|
|
require base_path('routes/web/components.php');
|
2016-12-15 20:52:39 -08:00
|
|
|
require base_path('routes/web/users.php');
|
2018-10-19 07:30:25 -07:00
|
|
|
require base_path('routes/web/kits.php');
|
2016-12-14 04:32:24 -08:00
|
|
|
require base_path('routes/web.php');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the "api" routes for the application.
|
|
|
|
*
|
|
|
|
* These routes are typically stateless.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function mapApiRoutes()
|
|
|
|
{
|
|
|
|
Route::group([
|
2017-01-11 14:50:38 -08:00
|
|
|
'middleware' => 'auth:api',
|
2016-12-14 04:32:24 -08:00
|
|
|
'namespace' => $this->namespace,
|
|
|
|
'prefix' => 'api',
|
|
|
|
], function ($router) {
|
|
|
|
require base_path('routes/api.php');
|
2016-03-25 01:18:05 -07:00
|
|
|
});
|
|
|
|
}
|
2021-06-10 13:17:07 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Configure the rate limiters for the application.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function configureRateLimiting()
|
|
|
|
{
|
|
|
|
RateLimiter::for('api', function (Request $request) {
|
|
|
|
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
|
|
|
});
|
|
|
|
}
|
2016-03-25 01:18:05 -07:00
|
|
|
}
|