Skip to content

Instantly share code, notes, and snippets.

@mass6
Created January 4, 2020 10:27
Show Gist options
  • Select an option

  • Save mass6/1a6da6114de1c83a2b6dd04af7fdfc57 to your computer and use it in GitHub Desktop.

Select an option

Save mass6/1a6da6114de1c83a2b6dd04af7fdfc57 to your computer and use it in GitHub Desktop.

Revisions

  1. mass6 created this gist Jan 4, 2020.
    5 changes: 5 additions & 0 deletions ChallengeService.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    $currentMinute = Carbon::parse($userStartTime)->startOfMinute();
    $diff = (int) $this->roundUpToAny($currentMinute->minute, 5) - $currentMinute->minute; // 50
    $additionalMinutes = (integer) $this->roundUpToAny(mt_rand(120, 360), 5);
    $start_time = $currentMinute->addMinutes($diff + $additionalMinutes);
    dd($start_time);