Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * Returns a single Question.
  *
  * @param null $question
  * @return null
  */
 public function getQuestion($question = null)
 {
     return Question::resolveSelf($question);
 }