diff options
author | Iuri de Silvio <iurisilvio@gmail.com> | 2017-12-21 01:14:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-21 01:14:51 +0300 |
commit | 25094345d1ddf405837f25c7a3c114d228802898 (patch) | |
tree | ac186379610c5b9e34023e4542d077322229dd84 /app | |
parent | 2068eba42b74ae0b278ff1848c9d39c712bba609 (diff) |
Avoid link counting for unlimited quota
Diffstat (limited to 'app')
-rw-r--r-- | app/Helpers/ApiHelper.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/Helpers/ApiHelper.php b/app/Helpers/ApiHelper.php index 5f629f8..cc5e91b 100644 --- a/app/Helpers/ApiHelper.php +++ b/app/Helpers/ApiHelper.php @@ -23,11 +23,15 @@ class ApiHelper { $api_quota = env('SETTING_ANON_API_QUOTA') ?: 5; } + if ($api_quota == -1) { + return false; + } + $links_last_minute = Link::where('is_api', 1) ->where('creator', $username) ->where('created_at', '>=', $last_minute) ->count(); - return ($api_quota > -1 && $links_last_minute >= $api_quota); + return $links_last_minute >= $api_quota; } } |