Пример #1
0
 /**
  * 展示公司试题
  */
 public function getShowexam($id)
 {
     $q_info = Question::where('e_id', $id)->get();
     print_r($q_info);
 }
 private function missingRequiredAnswers($application)
 {
     // Generate an array of answers based on their associated question ID
     $answers = [];
     foreach ($application->answers as $answer) {
         $answers[$answer->question_id] = $answer;
     }
     // Loop through all required questions
     $questions = Question::where('required', 1)->get();
     foreach ($questions as $question) {
         if (!isset($answers[$question->id])) {
             return true;
         }
         if (empty($answers[$question->id]->answer)) {
             return true;
         }
     }
     return false;
 }
Пример #3
0
 /**
  * @return mixed
  */
 public function getQuestion($id)
 {
     return Question::where('id', $id)->first();
 }
Пример #4
0
public function getStatus0(){
return view('questions.index',[
'questions'=>Question::where('status','=','0')->paginate(),
'titlePage' => 'Актуальные вопросы'
]);
}
 public function displayQuestion($category, $value)
 {
     //TODO:: Check to see if question is apart of gameboard.
     $question = Question::where('category', $category)->where('value', $value)->active()->random()->first();
     if (empty($question)) {
         $category = Category::find($category);
         $this->handler->sendMessageMention($this->channel, $this->userName, "Question does not exist, probaby double jep");
         $this->updateGameBoard($this->boardKey, $category->name, $value);
         $board = $this->getGameBoard($this->boardKey);
         $this->handler->displayBoard($this->channel, $board);
         return null;
     } else {
         //TODO Create Relationship
         $currentCategory = Category::where('id', $question->category)->first();
         $question->category = $currentCategory->name;
         $this->handler->sendMessage($this->channel, trans('gamecommands.question', ['category' => $question->category, 'total' => $question->value, 'question' => $question->question]));
     }
     Cache::put($this->currentQuestionKey, $question, 1);
     return $question;
 }