简体   繁体   English

Laravel 油门秒覆盖

[英]Laravel Throttle overwrite in second

How to use laravel throttle in second instead of in minute?如何在秒而不是分钟内使用 laravel 油门? I want to use this for chat app, and i think limiting it to second will be better.我想将它用于聊天应用程序,我认为将它限制为秒会更好。

and i tried to overwrite the laravel middleWareGroup throttle with this我试图用这个覆盖 laravel middleWareGroup 油门

Route::get("/v0/chat/get/{room}","chatController@chat_get")->middleware('throttle:120,1');

but the ->middleware() overwrite failed.但 ->middleware() 覆盖失败。 Thanks谢谢

You must see ThrottlesLogin.php, at lockoutTime method to understand about lockoutTime.您必须在lockoutTime方法中查看 ThrottlesLogin.php 以了解 lockoutTime。

protected function lockoutTime()
{
    return property_exists($this, 'lockoutTime') ? $this->lockoutTime : 60;
}

If you want to custom lockoutTime, init it in your controller $lockoutTime =???如果您想自定义锁定时间,请在您的 controller $lockoutTime =???

With this issue , you can use throttle in seconds.有了这个问题,你就可以秒使用油门了。

Now it is possible to use float for seconds, like 0.5 = 30 seconds.现在可以使用 float 秒,比如 0.5 = 30 秒。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM