0👍
Actually I’m a bit confused with the code. But I think you want to save to $commentaire
, and to do so, the last line of storereply
function should look like this
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);
$commentairereply->save();
}
Source:stackexchange.com