aboutsummaryrefslogtreecommitdiff
path: root/app/Http/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/Http/Controllers')
-rw-r--r--app/Http/Controllers/ReservationsController.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/Http/Controllers/ReservationsController.php b/app/Http/Controllers/ReservationsController.php
index 1865f46..249d18a 100644
--- a/app/Http/Controllers/ReservationsController.php
+++ b/app/Http/Controllers/ReservationsController.php
@@ -92,6 +92,14 @@ class ReservationsController extends Controller
$validator = Validator::make($request->all(), $rules, $messages);
+ $validator->after(function ($validator) use ($request) {
+ $fromStamp = strtotime($request->sdate . ' ' . $request->stime);
+ $toStamp = strtotime($request->edate . ' ' . $request->etime);
+ if (!($fromStamp < $toStamp)) {
+ $validator->errors()->add('time', 'FROM time and date needs to be before TO time and date.');
+ }
+ });
+
if ($validator->fails()) {
return Redirect::back()
->withErrors($validator)