/** * Answer a Question. * * @param $question * @param $value * @return Model|Answer */ public function answerQuestion($question, $value) { $question = Question::resolveSelf($question); $answer = $this->getAnswerFromQuestion($question); if (!$answer) { $answer = $this->createNewAnswer($question, $value); } else { $answer = $this->updateExistingAnswer($answer, $value); } $this->touch(); return $answer; }
/** * Returns a single Question. * * @param null $question * @return null */ public function getQuestion($question = null) { return Question::resolveSelf($question); }