/** * Store a newly created resource in storage. * * @return Response */ public function store(PollingRequest $request) { // $input = $request->all(); $polling = new Polling($input); if ($input['status'] == 'Y') { Polling::where('status', '=', 'Y')->update(['status' => 'N']); } if ($polling->save()) { return response()->json(array('success' => TRUE)); } }