/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(UpdateEventRequest $req, $slug) { $input = $req->all(); // Ensures database times are always in UTC. foreach ($input as $key => $value) { // Ensures only time fields are changed. if (!strpos($key, 'time')) { continue; } // Converts time from PST to UTC. $pst = new Carbon($value, 'America/Los_Angeles'); $utc = $pst->setTimezone('UTC'); // Sets date/time string back into values for database. $input[$key] = $utc->toDateTimeString(); } Event::findBySlug($slug)->update($input); return redirect()->action('EventsController@show', $slug); }