public function updateStaff()
 {
     $rules = array('staffid' => 'required', 'surname' => 'required', 'othernames' => 'required', 'gender' => 'required', 'birthdate' => 'required', 'mobile' => 'required', 'designation' => 'required');
     $validation = Validator::make(Input::all(), $rules);
     if ($validation->fails()) {
         $staff = StaffInfo::where('staff_id', '=', Input::get('staffid'))->first();
         return View::make('Staff.newStaff')->with('staff', $staff)->with('designations', Designations::all())->with('form_error_message', $validation->errors()->first());
     } else {
         $dob = new DateTime(Input::get('birthdate'));
         $affectedRows = StaffInfo::where('staff_id', '=', Input::get('staffid'))->update(array('designation_id' => Input::get('designation'), 'surname' => Input::get('surname'), 'other_names' => Input::get('othernames'), 'gender' => Input::get('gender'), 'date_of_birth' => date_format($dob, 'Y-m-d'), 'contact_no' => Input::get('mobile'), 'email' => Input::get('email'), 'postal_address' => Input::get('postaladdress'), 'residential_address' => Input::get('residentialaddress'), 'ssn' => Input::get('ssn'), 'nok_name' => Input::get('nokname'), 'nok_contact' => Input::get('nokcontact'), 'nok_address' => Input::get('nok_address'), 'updated_by' => Auth::user()->get_user_id(), 'updated_at' => date('Y-m-d'), 'status' => 1));
         if ($affectedRows > 0) {
             $staff = StaffInfo::where('staff_id', '=', Input::get('staffid'))->first();
             return View::make('Staff.newStaff')->with('staff', $staff)->with('designations', Designations::all())->with('success_message', 'Update complete.');
         } else {
             $staff = StaffInfo::where('staff_id', '=', Input::get('staffid'))->first();
             return View::make('Staff.newStaff')->with('staff', $staff)->with('designations', Designations::all())->with('form_error_message', 'An error occured while updating staff infomation.');
         }
     }
 }
 public function assign()
 {
     $users = User::lists('name', 'id');
     $schools = Schools::lists('school_name', 'id');
     $departments = Departments::lists('department_name', 'id');
     $designations = Designations::lists('designation', 'id');
     return view('Designation.assign', compact('schools', 'departments', 'designations', 'users'));
 }