接收不到id是为什么

想做一个考试答题系统,但是提交的时候,接收不到题目id和卷子id,所以没办法存到数据库,哪位大神帮我看看怎么回事?

    if ($hwpaper->save()){
        $questions = HwQuestion::where('hw_knowledge_id', '=', $hwpaper->hw_knowledge_id)
              ->where('diffculty', '=', $hwpaper->diffculty)
              ->where('q_number', '>=', $hwpaper->start_number)
              ->where('q_number', '<=', $hwpaper->end_number)
              ->get();
        $paper_id = $hwpaper->id;
//       dd($questions);
        return view('student.homework.practice', compact('questions', 'paper_id'));
     } else {
        return Redirect::back()->withInput()->withErros('失败');
     }

  }

  public function postQuestion(Request $request)
  {
//    dd(Input::all());
     $hwanswer = new HwStudentAnswer;
     $hwanswer->hw_question_id = Input::get('question','1');
     $hwanswer->hw_paper_id = Input::get('paper_id','167');
     $hwanswer->selected_answer = Input::get('selected_answer');
//    dd($hwanswer);
     $hwanswer->save();
     return $this->postRevise();
  }

view

{{  }}{{ }}


小轩1986
浏览 1483回答 1
1回答

紫焰123

laravel吧。你这代码太少了,没法看啊。最好把代码编辑一下,显示高亮,最好把必要的打印值显示出来
打开App,查看更多内容
随时随地看视频慕课网APP