Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $question = new Question();
- $answer = new Answer();
- foreach ($request->get('questions') as $idnex => $question) {
- $question->book_id = $request->get('bookId');
- $question->question = $question;
- $question->save();
- foreach ($request->get('answers') as $idnex => $answer) {
- $answer->answer = $answer;
- $answer->question_id = $question->id;
- if ($request->has("isCorrect[{$index}]")) {
- $answer->is_correct = 1;
- } else {
- $answer->is_correct = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement