private function checkUpdationApiKeys($id)
 {
     $api_keys = Apikey::where("uid", '=', $id)->where("verify", "=", 0)->get();
     foreach ($api_keys as $APIKEY) {
         $akey = $APIKEY['apikey'];
         $vkey = $APIKEY['vkey'];
         $eveLibrary = new EveLibrary();
         $char_data = $eveLibrary->getCharList($akey, $vkey);
         if (!empty($char_data['error'])) {
             continue;
         }
         $insert = $this->insertCharList($id, $char_data, $akey, $vkey);
         if ($insert) {
             $status = 1;
             $this->updateApiKeyVerification($id, $akey, $vkey, $status);
         }
     }
 }
 /**
  * Update profile of newly registered user
  *
  * @param  Request  $request
  * @return Response
  */
 public function complete(Request $request)
 {
     //$user = User::find(1);
     //Auth::login($user);
     if ($request->isMethod('post')) {
         $formData = $request->all();
         $user = Auth::user();
         $id = Auth::user()->id;
         $profile = Profile::where("user_id", '=', $id)->first();
         if ($profile['origin'] == "vk" && empty($user->vk_email)) {
             $rules = array('email' => 'required|max:50|unique:users,email,' . $id, 'name' => 'required|max:50');
             $user->vk_email = $request->get('email');
         } else {
             $rules = array('name' => 'required|max:50');
         }
         $validator = Validator::make($formData, $rules);
         if ($validator->fails()) {
             return Redirect::to('/login/complete')->withInput()->withErrors($validator);
         }
         // $formData['email'] = Auth::user()->email;
         // need server side validation before it goes to db
         $user->name = trim($request->get('name'));
         $user->save();
         $eve_api_key = $request->get('eve_api_key');
         $eve_user_id = $request->get('eve_user_id');
         $i = 0;
         foreach ($eve_user_id as $key => $value) {
             $Apikey = new Apikey();
             if (empty($value) || empty($eve_api_key[$key])) {
                 continue;
             }
             $row_id = Apikey::where('apikey', $value)->where("uid", "=", $user->id)->first();
             if (!empty($row_id)) {
                 $row = $row_id;
             } else {
                 $row = $Apikey;
             }
             $row->uid = $user->id;
             $row->apikey = $value;
             $row->vkey = $eve_api_key[$key];
             //$row->save();
             $i++;
         }
         /*if($i==0){			
         			Session::flash('error_message', 'Username or password is incorrect'); 
         			return redirect("/login/complete") ;
         		}else{
         			Session::flash('error_message', 'Username or password is incorrect'); 
         		}*/
         return redirect('/')->withMessage("Profile Updated");
     }
     $formData = Auth::user();
     $id = $formData->id;
     $api_keys = User::find($id)->apikeys;
     $profile = Profile::where("user_id", '=', $id)->first();
     $view_data = ['title' => "Complete your profile", 'form_data' => $formData, 'apikey' => $api_keys, 'profileData' => $profile];
     return view('login/complete', $view_data);
 }