public function advantage(Shop $shop, Request $request) { if (!$request->has('advantage')) { $shop->advantages()->detach(); } else { $shop->advantages()->sync($request->input('advantage')); } Flash::success('Adv info updated'); return redirect()->back(); }