public function postNewElection() { //verify the user input and create account $validator = Validator::make(Input::all(), array('Title' => 'required|max:60', 'Starting_Date' => 'required', 'Clossing_Date' => 'required')); if ($validator->fails()) { return Redirect::route('admin-new-election-get')->withErrors($validator)->withInput()->with('globalerror', 'Sorry!! The Data was not Saved, please retry'); } 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'))); //register the new user $newelection = Election::create(array('Title' => $title, 'Starting_Date' => $startingdate, 'Clossing_Date' => $clossingdate, 'Active' => TRUE)); if ($newelection) { return Redirect::route('admin-new-election-get')->with('globalsuccess', 'New Post Details Have been Added'); } } }