diff options
author | Chaoyi Zha <summermontreal@gmail.com> | 2017-04-16 00:22:07 +0300 |
---|---|---|
committer | Chaoyi Zha <summermontreal@gmail.com> | 2017-04-16 00:22:07 +0300 |
commit | 8cc59e268cf0dbcc6f27f113082c1516b2aa9279 (patch) | |
tree | e33ef8b638df162723831ff3b6083391556d3f66 /app | |
parent | b712395651bbef4276f5a1142d418ca465bf3197 (diff) |
Show an error if right bound is in the future
Diffstat (limited to 'app')
-rw-r--r-- | app/Http/Controllers/StatsController.php | 6 |
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.'); } |