【发布时间】:2020-06-18 15:23:52
【问题描述】:
我想恢复输入以将其插入到我的数据库中,但显示未定义的索引错误,但我确定索引是相似的!!!!!!
这是我的 ProjectDetail.vue 表单:
<form type="post" @submit.prevent="ajouterCommentaireReponse(comment.id)" v-
bind:id="comment.id " class="d-none">
<div class="input-group input-group-sm mt-2 ml-2">
<input class="form-control form-control-sm" name="replycomment"
type="text" placeholder="commenter.." style="width:450px;" >
<div class="input-group-append">
<button type="submit" class="btn btn-success">Commenter</button>
</div>
</div>
</form>
这是控制器功能:
public function storereply(Request $request,$key){
$data =$request->all();
$commentaire=Commentaire::find($key);
$commentairereply =new Commentaire;
$commentairereply->user_id= auth()->user()->id;
$commentairereply->body = $data['replycomment'];
$commentairereply->comment_user_name=$commentaire->user->name;
$commentaire->comments()->save($commentairereply);
}
【问题讨论】:
-
您是否尝试过
dd($data);以查看replycomment 是否确实作为键之一存在?还可以尝试dd($request->replycomment).. -
我尝试了 dd($data) 但没有任何反应!!!
-
他什么都没给我看
标签: laravel vue.js vuejs2 laravel-6