Ejemplo n.º 1
0
 /**
  * Return list of all Questions.
  *
  * @param null $question_type
  * @param null $group
  * @param null $team_id
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 public function getQuestions($question_type = null, $group = null, $team_id = null)
 {
     return Question::where('team_id', $team_id)->when($group, function ($query) use($group) {
         return $query->where('group_id', Group::resolveSelf($group)->id);
     })->when($question_type, function ($query) use($question_type) {
         return $query->where('question_type_id', QuestionType::resolveSelf($question_type)->id);
     })->with('type')->get()->sortBy('order')->values();
 }