Created
November 15, 2017 01:46
-
-
Save Cyberiaaxis/810287aea567d3a4cae9f128f4a69de8 to your computer and use it in GitHub Desktop.
This file contains 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
$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(); | |
$data = []; | |
$now = Carbon::now(); | |
foreach($request->option as $key => $value) { | |
$data[] = [ | |
'question_id' => $ques->id, | |
'answers' => $value, | |
'created_at' => Carbon::now(), | |
'updated_at' => Carbon::now(), | |
]; | |
} | |
QuestionsOption::insert($data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment