public function setTypeAttribute($value) { $this->attributes['type'] = Types::getProperFormat($value); }
public function postAddGame() { $all = $this->request->all(); if (isset($all['google_id'])) { try { $user = User::where('google_id', $all['google_id'])->where('admin', true)->firstOrFail(); $client = new Client(); try { $game = $client->fetchGameByInstanceId($all['instanceId']); } catch (GameNotFoundException $e) { return $this->_error('Game could not be found'); } $client->updateTypeOfGame($all['instanceId'], Types::getProperFormat($all['type']), $all['passageId']); return Response::json(['error' => false, 'msg' => 'Game Added! '], 200); } catch (ModelNotFoundException $e) { return $this->_error('User account could not be found.'); } } }