From d1014c7834e80717f3115d09626adafe444e8187 Mon Sep 17 00:00:00 2001 From: Helias Date: Fri, 25 Sep 2015 16:43:12 +0200 Subject: [PATCH] Added parameter time to the auction route --- app/Http/routes.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/Http/routes.php b/app/Http/routes.php index abc1153..60b1b8e 100755 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -1394,6 +1394,22 @@ } } + if (isset($_GET['time'])) + { + for ($i = 0; $i < count($result); $i++) + { + $datetime1 = new DateTime(); + $datetime2 = new DateTime('@'.$result[$i]->{'time'}); + $interval = $datetime1->diff($datetime2); + $timeleft = $interval->format('%a days %h hours %i minutes %S seconds'); + + $empties = array('0 days ', '0 hours ', '0 minutes ', '0 seconds '); + $timeleft = str_replace($empties, '', $timeleft); + + $result[$i]->{'time'} = $timeleft; + } + } + return Response::json($result); });