本文整理匯總了PHP中Food::rule_edit_food方法的典型用法代碼示例。如果您正苦於以下問題:PHP Food::rule_edit_food方法的具體用法?PHP Food::rule_edit_food怎麽用?PHP Food::rule_edit_food使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Food
的用法示例。
在下文中一共展示了Food::rule_edit_food方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: edit_post
public function edit_post($id)
{
$valid = Validator::make(Input::all(), Food::rule_edit_food($id), Food::$food_langs);
if ($valid->passes()) {
$data = Input::all();
$img = $data['food_image'];
$isUpload = $img->move("uploads/food/");
if ($isUpload) {
$data = array("food_name" => Input::get("food_name"), "food_price" => Input::get("food_price"), "food_description" => Input::get("food_description"), "food_image" => $img->getClientOriginalName(), "food_created_at" => date("Y-m-d"));
DB::table("foods")->where("food_id", $id)->update($data);
return Redirect::route("manage_food")->with("flash_success", "Chúc mừng bạn đã sửa món ăn thành công");
}
return Redirect::route("manage_food")->with("flash_error", "Không thể upload ảnh");
}
return Redirect::route("manage_food_edit_get", $id)->withInput()->with("flash_error", $valid->errors()->first());
}