Я хотел ограничить запрос API, специфичный для пользователя в приложении Laravel.
Я попытался следующий код для создания настраиваемого газа, упомянутого в https://github.com/dingo/api/wiki/Rate-Limiting#custom-throttles
use Illuminate\Container\Container;
use Dingo\Api\Http\RateLimit\Throttle\Throttle;
class CustomThrottle extends Throttle
{
public function match(Container $app)
{
// Perform some logic here and return either true or false depending on whether
// your conditions matched for the throttle.
}
}
Я пытался добавить этот код:
'throttling' => [
'custom' => new CustomThrottle(['limit' => 200, 'expires' => 10])
]
в Middleware в Kernel.php. Но в среде IDE выдается сообщение об ошибке Expressions not allowed
Как я могу создать дроссель API на основе пользователя в Laravel, используя Dingo?