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
path: root/app
diff options
context:
space:
mode:
authorChaoyi Zha <summermontreal@gmail.com>2017-04-16 00:22:07 +0300
committerChaoyi Zha <summermontreal@gmail.com>2017-04-16 00:22:07 +0300
commit8cc59e268cf0dbcc6f27f113082c1516b2aa9279 (patch)
treee33ef8b638df162723831ff3b6083391556d3f66 /app
parentb712395651bbef4276f5a1142d418ca465bf3197 (diff)
Show an error if right bound is in the future
Diffstat (limited to 'app')
-rw-r--r--app/Http/Controllers/StatsController.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/Http/Controllers/StatsController.php b/app/Http/Controllers/StatsController.php
index 1ddebd8..193d1d1 100644
--- a/app/Http/Controllers/StatsController.php
+++ b/app/Http/Controllers/StatsController.php
@@ -30,6 +30,12 @@ class StatsController extends Controller {
$left_bound = $user_left_bound ?: Carbon::now()->subDays(self::DAYS_TO_FETCH);
$right_bound = $user_right_bound ?: Carbon::now();
+ if (Carbon::parse($right_bound)->gt(Carbon::now()) && !session('error')) {
+ // Right bound must not be greater than current time
+ // i.e cannot be in the future
+ return redirect()->back()->with('error', 'Right date bound cannot be in the future.');
+ }
+
if (!$this->isLoggedIn()) {
return redirect(route('login'))->with('error', 'Please login to view link stats.');
}