Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // $quiz->setUsernameOrEmail($formData['usernameOrEmail']);
- // $quiz->setPassword($formData['password']);
- // $quiz->login();
- //////////
- // $questions = $quiz->questions->keyBy('id'); // get all quiz questions with their ID as the array key
- //
- // // Update Quiz data
- // $quiz->name = $input['name'];
- // $quiz->theme = $input['theme'];
- // try {
- // $quiz->save(); // save the original model object
- // } catch (\Exception $e) {
- //
- // };
- //
- // foreach ($input['questions'] as $id => $inputQuestion) {
- // $originalQuestion = $questions->get($id); // get original question model object by id
- // $originalQuestion->update([
- // 'question' => $inputQuestion['question'] // update original question by the users input
- // ]);
- //
- // try {
- // $originalQuestion->save(); // save the original model object
- // } catch (\Exception $e) {
- //
- // };
- //
- // $answers = $originalQuestion->answers->keyBy('id'); // get all answers with their ID as the array key
- //
- // foreach ($inputQuestion['answers'] as $id => $inputAnswer) {
- // $originalAnswer = $answers->get($id);
- //
- // $originalAnswer->update([
- // 'answer' => $inputAnswer,
- // 'correct_choice' => ($id == $inputQuestion['correct_choice']) ? 1 : 0
- // ]);
- //
- // try {
- // $originalAnswer->save(); // save the original model object
- // } catch (\Exception $e) {
- //
- // };
- // }
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement