本文整理汇总了PHP中app\Address::related_rules方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::related_rules方法的具体用法?PHP Address::related_rules怎么用?PHP Address::related_rules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Address
的用法示例。
在下文中一共展示了Address::related_rules方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
* PUT /warehouses/{id}
*
* @param int $id
* @return Response
*/
public function update($id, Request $request)
{
$warehouse = Warehouse::findOrFail($id);
$address = $warehouse->address;
$this->validate($request, Address::related_rules());
// http://stackoverflow.com/questions/17950118/laravel-eloquent-how-to-update-a-model-and-related-models-in-one-go
$warehouse->update(array_merge($request->all(), ['alias' => $request->input('address.alias')]));
$request->merge($request->input('address'));
$request->merge(['notes' => '']);
$address->update($request->except(['address']));
return redirect('warehouses')->with('info', l('This record has been successfully updated :: (:id) ', ['id' => $id], 'layouts') . $request->get('name_commercial'));
}