try again

This commit is contained in:
gilesb 2024-03-09 15:32:32 +00:00
parent 1f3f1d7299
commit c7cd0468f1
2 changed files with 184 additions and 186 deletions

View File

@ -30,7 +30,7 @@ class RouteServiceProvider extends ServiceProvider
$this->registerGlobalRouteParamConstraints();
$this->routes(function () {
Route::middleware('api')
Route::middleware($_ENV['APP_API_PREFIX'] ?? 'api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
});
@ -43,7 +43,7 @@ class RouteServiceProvider extends ServiceProvider
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
RateLimiter::for($_ENV['APP_API_PREFIX'] ?? 'api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}

View File

@ -34,7 +34,6 @@ use Illuminate\Support\Facades\Storage;
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::group(['prefix' => $_ENV['API_PREFIX'] ?? ''], function () {
Route::group(['middleware' => 'auth:api'], function () {
Route::post('logout', [LoginController::class, 'logout']);
@ -236,4 +235,3 @@ Route::group(['prefix' => $_ENV['API_PREFIX'] ?? ''], function () {
Route::get('caddy/ask-certificate/{secret?}', [\App\Http\Controllers\CaddyController::class, 'ask'])
->name('caddy.ask')->middleware(\App\Http\Middleware\CaddyRequestMiddleware::class);
});