你好,我怎么可以更新我的上表中的数据? 还使用foreach循环来获取所有数据。 帮助谢谢
现在我的代码在这里给我的错误是我的错误
参数太少,以功能应用\ HTTP \控制器\管理\ SettingsController ::指数(),1过去了,准确地预计2
我的index.php,表
{!! Form::open(['action' => ['Admin\SettingsController@update', $setting->id], 'method' => 'POST']) !!}
<tbody>
@foreach ($settings as $setting)
<tr>
<td> {{Form::text('settings_code', $setting->settings_code, ['class' => 'form-control', 'placeholder' => 'Enter a Flight Number'])}}</td>
<td>{{ $setting->subject }}</td>
<td>{{ $setting->description }}</td>
<td>
{{Form::hidden('_method', 'PUT')}}
{{Form::submit('Update', ['class'=>'btn btn-primary',
'name'=>'submit'])}} <br><br>
</td>
</tr>
@endforeach
</tbody>
{!! Form::close() !!}
我控制器
public function index()
{
$settings = Setting::where('settings_code', '<>', 'SESSION_VALIDITY')->get();
$setting = Setting::find($id);
$setting->settings_code = $request->input('settings_code');
$setting->save();
return view('admin.settings.index', compact('settings'));
}