我有一個包含設置列表的表單,所有設置都有自己的ID,通過簡單的foreach循環顯示。當用戶點擊更新按鈕時,我希望能夠使用Anahkiasen/Former更新所有的值。但是,我似乎無法找到關於如何提交多個記錄集的文檔。使用Laravel中的前一次更新多個行
舉例來說,如果我打開表單編輯只是一個設定,而不是所有的人,我只想做到以下幾點:
{{ Former::open()->method('PUT')->action(URL::to('settings/' . $setting['id'])) }}
這將其發送給我的「更新」資源的方法和下面的代碼會照顧的更新:
public function update($id)
{
$setting = Setting::findOrFail($id);
if ($setting->save()) {
return Redirect::back()->with('message', "Setting #$id updated!");
} else {
return Redirect::back()->withInput()->withErrors($setting->errors());
}
}
是否可以同時做這與多個記錄,並仍然使用便捷$autoHydrateEntityFromInput
和$forceEntityHydrationFromInput
功能?
我正在使用Laravel 4.1和3.4.2。