Created
November 12, 2017 14:13
-
-
Save Cyberiaaxis/d78b1184caf0d1a8045d5b9fd74ad293 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function store(Request $request) | |
{ | |
$ques = new Question(); | |
$ques->question_text = $request['question_text']; | |
$ques->code_snippet = $request['code_snippet']; | |
$ques->answer_explanation = $request['answer_explanation']; | |
$ques->more_info_link = $request['more_info_link']; | |
$ques->category_id = $request['category_id']; | |
$ques->topic_id = $request['topic_id']; | |
$ques->save(); | |
$i=0; | |
foreach($request as $key){ | |
print_r($request['correct']); | |
$questionOption = new QuestionsOption(); | |
$questionOption->question_id = $ques->id; | |
$questionOption->option = $request['option'. $i]; | |
if($request['option'. $i] == $request['correct']){ | |
$questionOption->option = 1; | |
} | |
$questionOption->save(); | |
$i++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what is wrong here?