/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param Menu $menu * @return \Illuminate\Http\Response */ public function update(MenuRequest $request, Menu $menu) { if ($menu->update($request->all())) { Flash::success('保存成功!'); } else { Flash::error('保存失败!'); } return Redirect::back(); }
public function update(MenuRequest $request, $id) { // $input = $request->all(); $menu = Menu::find($id); if ($menu->update($input)) { return response()->json(array('success' => TRUE)); } }
/** * Updates the current record in the database * * @param $id * @param MenuRequest $request * @return \Illuminate\Http\RedirectResponse */ public function update($id, MenuRequest $request) { $inputs = $request->all(); if ($request->get('is_main_course') === null) { $inputs['is_main_course'] = 0; } $menu = Menu::findOrFail($id); $menu->update($inputs); flash()->message('Successfully updated: ' . $menu->name, 'success'); return redirect()->route('admin.menus.edit', [$menu->id]); }
/** * Update the specified resource in storage. * * @param App\Http\Requests\PostUpdateRequest $request * @param int $id * @return Response */ public function putUpdate(MenuRequest $request, $id) { $this->menu_gestion->update($request->all(), $id); $request->session()->flash('alert-success', 'Menu has been updated successfully'); return redirect('admin/menu'); exit; }