/** * @param $id * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse */ public function sorting($id, Request $request) { if (is_array($request->get('order')) && $request->get('order')) { foreach ($request->get('order') as $key => $value) { if (Menu::whereGroupId($id)->whereId($key)->count()) { $menu = Menu::find($key); $menu->update(['order_id' => $value]); } } } return $this->redirect->back(); }