File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,11 @@ public function register()
31
31
return new MemcachedConnector ;
32
32
});
33
33
34
- $ this ->app ->singleton (RateLimiter::class);
34
+ $ this ->app ->singleton (RateLimiter::class, function ($ app ) {
35
+ return new RateLimiter ($ app ->make ('cache ' )->driver (
36
+ $ app ['config ' ]->get ('cache.limiter ' )
37
+ ));
38
+ });
35
39
}
36
40
37
41
/**
Original file line number Diff line number Diff line change @@ -153,13 +153,25 @@ public function resetAttempts($key)
153
153
* @param int $maxAttempts
154
154
* @return int
155
155
*/
156
- public function retriesLeft ($ key , $ maxAttempts )
156
+ public function remaining ($ key , $ maxAttempts )
157
157
{
158
158
$ attempts = $ this ->attempts ($ key );
159
159
160
160
return $ maxAttempts - $ attempts ;
161
161
}
162
162
163
+ /**
164
+ * Get the number of retries left for the given key.
165
+ *
166
+ * @param string $key
167
+ * @param int $maxAttempts
168
+ * @return int
169
+ */
170
+ public function retriesLeft ($ key , $ maxAttempts )
171
+ {
172
+ return $ this ->remaining ($ key , $ maxAttempts );
173
+ }
174
+
163
175
/**
164
176
* Clear the hits and lockout timer for the given key.
165
177
*
You can’t perform that action at this time.
0 commit comments