Skip to content
This repository has been archived by the owner on Jun 16, 2019. It is now read-only.

Commit

Permalink
Added parameter time to the auction route
Browse files Browse the repository at this point in the history
  • Loading branch information
Helias committed Sep 25, 2015
1 parent f13fb4f commit d1014c7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down

0 comments on commit d1014c7

Please sign in to comment.