在注释掉那句话之后,用这种方式写插入不了数据
$data=[
'user_id'=>\Auth::user()->id,
'last_user_id'=>\Auth::user()->id,
];
$discussion=Discussion::create($request->all(),$data);
return redirect()->action('PostsController@show',['id'=>$discussion->id]);
而用这种方式写
$discussion=$request->all();
$discussion['user_id']=\Auth::user()->id;
$discussion['last_user_id']=\Auth::user()->id;
$discussion=Discussion::create($discussion);
return redirect()->action('PostsController@show',['id'=>$discussion->id]);
完美插入