/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(ListFormRequest $request, $id) { $list = Todolist::find($id); $list->update(['name' => $request->get('name'), 'description' => $request->get('description')]); if (count($request->get('categories')) > 0) { $list->categories()->sync($request->get('categories')); } return \Redirect::route('lists.edit', array($list->id))->with('message', 'Your list has been updated!'); }
/** * Update the specified resource in storage. * * @param ListFormRequest $request * @param int $id * @return Response */ public function update(ListFormRequest $request, $id) { $list = Todolist::find($id); $list->update(['name' => $request->get('name'), 'description' => $request->get('description')]); $categories = $request->get('categories'); $list->categories()->sync($categories); return \Redirect::route('lists.edit', [$list->id])->with('message', 'List has been updated.'); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update($id, ListFormRequest $request) { $list = Todolist::find($id); $list->update(['name' => $request->get('name'), 'description' => $request->get('description')]); return \Redirect::route('lists.edit', array($list->id))->with('message', 'Your list has been updated!'); }