public function getuserdetails($data = Null)
 {
     $editid = $data;
     $profileeditbyid = profileModel::where('ID', $editid)->get()->toArray();
     //$checked = $profileeditbyid[0]['status'];
     return View::make('user/register/userregister')->with('profileeditbyid', $profileeditbyid);
 }
 public function editmyprofile()
 {
     $GeneralData = array_filter(Input::except(array('_token', 'passwordhidden', 'profilepicture', 'maritalstatus', 'interest_id', 'userid', 'timezone', 'dateofbirth')));
     $timezone = Input::get('timezone');
     $GeneralData['dateofbirth'] = timezoneModel::convert(Input::get('dateofbirth'), $timezone, 'UTC', 'Y-m-d');
     $newimg = Input::file('profilepicture');
     if ($newimg != '') {
         $destinationPath = 'public/assets/upload/profile';
         $filename = Input::file('profilepicture')->getClientOriginalName();
         $Image = str_random(8) . '_' . $filename;
         $GeneralData['profilepicture'] = $Image;
         $uploadSuccess = Input::file('profilepicture')->move($destinationPath, $Image);
     } else {
         $GeneralData['profilepicture'] = Input::get('profileimgedithidden');
     }
     $data = Input::get('userid');
     $newpassword = Input::get('password');
     $updaterules = array('username' => 'required|unique:user,username,' . $data, 'password' => 'confirmed:min:5', 'email' => 'required|email|unique:user,email,' . $data);
     $validation = Validator::make($GeneralData, $updaterules);
     if ($validation->passes()) {
         if ($newpassword != "") {
             $GeneralData['password'] = Hash::make(Input::get('password'));
         }
         unset($GeneralData["password_confirmation"]);
         $affectedRows = profileModel::where('ID', $data)->update($GeneralData);
         $interest_id = Input::get('interest_id');
         $interestid = explode(',', $interest_id);
         $interestidcount = count($interestid);
         $interest['user_id'] = Input::get('userid');
         $affectedRows = userinterestModel::where('user_id', $data)->delete();
         for ($i = 0; $i < $interestidcount; $i++) {
             $interest['interest_id'] = $interestid[$i];
             $validationinterest = Validator::make($interest, userinterestModel::$rules);
             if ($validationinterest->passes()) {
                 $userregister = userinterestModel::create($interest);
             }
         }
         $Response = array('success' => '1', 'message' => 'Record Updated successfully');
         return json_encode($Response);
     } else {
         $Response = array('success' => '0', 'message' => $validation->messages()->first());
         $final = array("response" => $Response);
         return json_encode($final);
     }
 }