laravel:如何绕过

问题描述 投票:0回答:1

在我的 Laravel 项目中 这两个查询正在关于我的路线中间件的任何地方执行,我需要在某些路线上跳过它们,我该怎么做

我尝试在内核中创建“withoutThrottle”中间件,如下所示

但它不起作用

laravel throttling laravel-middleware
1个回答
0
投票

您可以通过将路线分组到

api.php
中来跳过路线,例如:


Route::wihtouMiddleware(['throttle:api'])->group(function () {
    Route::post('/x', function () {
        // ...
    });
 
    Route::post('/y', function () {
        // ...
    });
});

或单一路线:

Route::post('/x', function () {
 // ...
})->wihtouMiddleware(['throttle:api']);
© www.soinside.com 2019 - 2024. All rights reserved.