Laravel将相关数据保存在数据库中

时间:2019-08-13 17:42:57

标签: laravel save

我想使用邮寄表格将问题ID保存在答案表中

我尝试使用foreach或函数,但是我总是得到空数据

控制器

public function store(Request $request, Survey $survey)
{
    $request->validate([
        'answer' => 'required',
    ]);

    $survey->option_name = unserialize($survey->option_name);

    $answers = new Answer([
        'answer' => $request->get('answer'),
        'commentaire' => $request->get('commentaire'),
        'user_id' => auth()->id(),
        'last_ip' => request()->ip(),
        'question_id' => $survey->questions,
        'survey_id' => $survey->id,
    ]);

    $answers->save();

    return redirect()->action('SurveyController@view_survey_answers', [$survey->id]);
}

answers表answers table 问题表的行:

  • id
  • survey_id
  • 标题
  • 时间戳

我总是得到空数据,或者我尝试使用where,但是却出现错误,例如id索引不存在...

1 个答案:

答案 0 :(得分:0)

查看:

ORG 0
     MOV A, #0
     MOV P2, #0
LOOP:
     INC P2
     CALL Delay
     SJMP LOOP

Delay:
      MOV R2, #3
      MOV R1, #0
      MOV R2, #0
DLP:
    DJNZ R0, DLP
    DJNZ R1, DLP
    DJNZ R2, DLP
    RET