Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cydrobolt/polr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChaoyi Zha <summermontreal@gmail.com>2018-01-08 06:32:09 +0300
committerChaoyi Zha <summermontreal@gmail.com>2018-01-08 06:32:09 +0300
commit216f0c75c0286154fdb314f0a4054014f75c1439 (patch)
treea93c4bd7f88b291146baf20ea0b0b9befe034d0c
parent9e4ad61e2b962dbbe310cc8378146f27e2ab8064 (diff)
parent5b48ab31ca9ecddb491e18213acd27e226eec1e2 (diff)
Merge branch 'patch-1' of https://github.com/iurisilvio/polr into iurisilvio-api_quota_index
-rw-r--r--app/Helpers/ApiHelper.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/Helpers/ApiHelper.php b/app/Helpers/ApiHelper.php
index 5f629f8..6c751fe 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 < 0) {
+ 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;
}
}