You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

98 lines
3.0 KiB

<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to your application's "home" route.
*
* Typically, users are redirected here after authentication.
*
* @var string
*/
public const HOME = '/';
/**
* Define your route model bindings, pattern filters, and other route configuration.
*/
public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
$this->routes(function () {
#region default
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
#endregion
#region violationparking
// if .env SYSTEM_VIOLATIONPARKING is set to true
// then load the violationparking routes
if (config('app.vpk', false)) {
Route::middleware('web')
->group(base_path('routes/system/violationparking/web.php'));
Route::middleware('api')
->prefix('api')
->group(base_path('routes/system/violationparking/api.php'));
}
#endregion
#region multisys
if (config('app.ms', false)) {
Route::middleware('web')
->group(base_path('routes/system/multisys/web.php'));
Route::middleware('api')
->prefix('api')
->group(base_path('routes/system/multisys/api.php'));
}
#endregion
#region overspeed
if (config('app.osr', false)) {
Route::middleware('web')
->group(base_path('routes/system/overspeed/web.php'));
Route::middleware('api')
->prefix('api')
->group(base_path('routes/system/overspeed/api.php'));
#endregion
#region overspeed
Route::middleware('web')
->group(base_path('routes/system/red/web.php'));
Route::middleware('api')
->prefix('api')
->group(base_path('routes/system/red/api.php'));
}
#endregion
#region interval
if (config('app.itl', false)) {
Route::middleware('web')
->group(base_path('routes/system/interval/web.php'));
Route::middleware('api')
->prefix('api')
->group(base_path('routes/system/interval/api.php'));
}
#endregion
});
}
}