Last active
June 2, 2020 04:15
-
-
Save DarkGhostHunter/1bacb79cfe86141aee10f337bb5f9ab8 to your computer and use it in GitHub Desktop.
Simple Trait to throttle method calls.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Throttler; | |
trait ThrottlesCalls | |
{ | |
/** | |
* Throttles the next method call. | |
* | |
* @param int $tries | |
* @param int $minutes | |
* @return \App\Throttler | |
*/ | |
public function throttle($tries, $minutes) | |
{ | |
return app(Throttler::class)->setTarget($this)->throttle($tries, $minutes); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment