当我发帖删除下面的操作时:
public function deletenews($newsid)
{
$news = News::where('id',$newsid)->first();//find($comment_id)
$message = 'a string';
$msgstatus = 'another string';
...
return redirect()->route('usernews',[$message,$msgstatus]);
}
我想通过参数指示此操作:
public function usernews($message=null,$msgstatus=null)
{
...
return view('usercontrol.usernews',compact(['news','msgstatus','message']));
}
它重定向并且工作正常但不知何故参数总是为null,我将使用此参数来通知用户该记录被删除..
答案 0 :(得分:1)
public function deletenews($newsid)
{
$news = News::where('id',$newsid)->first();//find($comment_id)
$message = 'a string';
$msgstatus = 'another string';
...
return redirect()->route('usernews' ['message'=>$message,'msgstatus'=>$msgstatus]);
}
public function usernews(Request $request)
{
$message = $request->input('message');
$msgstatus = $request->input('msgstatus');
...
return view('usercontrol.usernews',compact(['news','msgstatus','message']));
}