/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(PollingRequest $request, $id) { // $input = $request->all(); $polling = Polling::find($id); if ($input['status'] == 'Y') { Polling::where('status', '=', 'Y')->update(['status' => 'N']); } if ($polling->update($input)) { return response()->json(array('success' => TRUE)); } }