public function onRun() { $pid = $_GET["id"]; $this->event = Session::where('id', $pid)->first()->load('speakers'); $this->event['start'] = gmdate("H\\hi", strtotime($this->event['start_time'])); $this->event['end'] = gmdate("H\\hi", strtotime($this->event['start_time']) + $this->event['duration'] * 60); }
public function onRun() { $this->sessions = Session::all()->toArray(); $this->locationsBuilder; $locations = Session::orderBy('location')->get(); $previousLocation = ""; for ($i = 0; $i < count($locations); $i++) { //Check if the previous location is the same as this one, if not add it to the locationBuilder if (strcmp($previousLocation, $locations[$i]['location']) !== 0) { if ($i == 0) { $this->locationsBuilder .= "'" . $locations[$i]['location'] . "'"; } else { $this->locationsBuilder .= ", '" . $locations[$i]['location'] . "'"; } } $previousLocation = $locations[$i]['location']; } foreach ($this->sessions as &$session) { $session['end_time'] = gmdate("Y-m-d H:i:s", strtotime($session['start_time']) + $session['duration'] * 60); } }