所以,我有一个报告系统,它从我的表单收集日期到数据库。我只想更新,在新闻表中,列活动,输入隐藏名称 =“活动”,当我点击我的表单上的提交时,我不知道怎么做。我现在只是将输入保存在报告中,但我还想更新新闻中的活动列。
路线
Route::post('career_report', 'CareerSolutionController@careerReport');
这是我的控制器
public function careerReport(requ $request, $id)
{
$report = \App\Reports::create([
'user_id' => $request['user_id'],
'username' => $request['username'],
'user_id_posted' => $request['user_id_posted'],
'username_posted' => $request['username_posted'],
'career_solution_id' =>$request['career_solution_id'],
'subject' =>$request['subject'],
'why_reporting' =>$request['why_reporting'],
'why_reporting_message' =>$request['why_reporting_message'],
'additional_message' =>$request['additional_message'],
'comment' =>$request['comment'],
'comment_user' =>$request['comment_user'],
'comment_id' =>$request['comment_id'],
]);
$news = News::findOrfail($id);
$news->active = $request['active'];
$news->save();
if($news != ""){
flash('News has been updated successfully', 'success');
}else{
flash('News update fail', 'warning');
}
if($report != ""){
flash('Career solution report submited', 'success');
}else{
flash('Career solution report', 'warning');
}
return Redirect::back();
}
现在,我需要在提交时将active
输入保存type="hidden"
在News
表格、列active
中。如何active
仅在从报告提交时使用新输入更新列?
素胚勾勒不出你