public function postEditElection() { //verify the user input $validator = Validator::make(Input::all(), array('Title' => 'required|max:60', 'Starting_Date' => 'required', 'Clossing_Date' => 'required')); if ($validator->fails()) { return Redirect::route('admin-view-elections-get')->with('globalerror', 'Please Try Again'); } else { $title = Input::get('Title'); $startingdate = date("Y-m-d", strtotime(Input::get('Starting_Date'))); $clossingdate = date("Y-m-d", strtotime(Input::get('Clossing_Date'))); $id = Input::get('Election_ID'); $election = Election::where('id', '=', $id)->first(); $election->Title = $title; $election->Starting_Date = $startingdate; $election->Clossing_Date = $clossingdate; if ($election->save()) { return Redirect::route('admin-view-elections-get')->with('globalsuccess', 'Election Details have been edited'); } } }