function sellNow(Request $request)
 {
     if (!Auth::check()) {
         return Redirect::to('/login');
     }
     if ($request->isMethod('post')) {
         $rules = array('inc_value' => 'required|numeric', 'char_detail' => 'required', 'title' => 'required', 'charname' => 'required', 'charid' => 'required');
         $formData = $request->all();
         $validator = Validator::make($formData, $rules);
         if ($validator->fails()) {
             return Redirect::to('/mycharacters')->withInput()->withErrors($validator);
         }
         $title = trim($request->get('title'));
         $char_detail = trim($request->get('char_detail'));
         $charid = trim($request->get('charid'));
         $inc_value = trim($request->get('inc_value'));
         $charname = trim($request->get('charname'));
         $id = Auth::user()->id;
         $characters = Character::where('uid', "=", $id)->where('char_id', '=', $charid)->first();
         //$characters  = Character::where('uid', "=",$id)->where('char_id','=',$charid)->get()->take(1);
         //$charObj = $characters;
         foreach ($characters as $char_dt) {
             if ($char_dt['sell_status'] != 0) {
                 return Redirect::to('/bazaar');
             }
         }
         $row_count = $characters->count();
         if (!empty($characters)) {
             $auction = new Eveapi();
             //$auction->uid = $id;
             //$auction->char_id = $charid;
             $auction->maintitle = $title;
             $auction->pilotname = $charname;
             $auction->lastpost_time = Carbon::now();
             $auction->update_status = 1;
             $auction->page = 1;
             $auction->status = 0;
             $auction->save();
             $last_inserid = $auction->id;
             $post_thread = new Evebid();
             $post_thread->bid_id = $last_inserid;
             $post_thread->char_id = $charid;
             $post_thread->post_rank = 1;
             $post_thread->post_time = Carbon::now();
             $post_thread->update_time = Carbon::now();
             $post_thread->wall_post = $char_detail;
             $post_thread->profile_link = $charid . "_128.jpg";
             $post_thread->username = $charname;
             $post_thread->bid_amount = $inc_value;
             $post_thread->save();
             $characters->sell_status = 1;
             $characters->save();
         }
         return Redirect::to('/bazaar');
     }
 }
 public function skills(Request $request)
 {
     if (!Auth::check()) {
         echo "You are not logged in. Please login";
         return;
     }
     //$user = User::find(11);
     //Auth::login($user);
     $charid = trim($request->get('charid'));
     $charname = trim($request->get('charname'));
     if ($charid == 93165396) {
         $charid = 93462573;
     }
     $japiflag = 0;
     try {
         $row = Character::where('char_id', $charid)->get()->take(1);
         if ($row) {
             foreach ($row as $data) {
                 $akey = $data['apikey'];
                 $vkey = $data['vkey'];
                 $char_id = $data['char_id'];
                 $japi = new JackLib($akey, $vkey, $char_id);
                 $api_result = $japi->skills();
                 if ($api_result) {
                     echo $api_result;
                     return;
                 }
             }
         }
     } catch (Exception $e) {
     }
     try {
         $EveboardControllerObj = new EveboardController();
         echo "<table class=\"table\"><tr><td><img src=\"http://image.eveonline.com/Character/" . $charid . "_128.jpg\"></td><td><h3>{$charname}</h3></td></tr></table>";
         $html = $EveboardControllerObj->getEveBoardSkills($charname);
         echo $html = str_replace("/res/groups/", "http://eveboard.com//res/groups/", $html);
         return;
     } catch (Exception $e) {
     }
     echo "<h4>Character SKILLS Not Found.<h4>";
     exit;
 }
 private function insertCharList($uid, $data, $akey, $vkey)
 {
     $flag = false;
     foreach ($data as $char) {
         $flag = true;
         $character_id = Character::where('uid', $uid)->where("char_id", "=", $char['characterID'])->first();
         if (!empty($character_id)) {
             $row = $character_id;
         } else {
             $row = new Character();
         }
         $row->char_id = $char['characterID'];
         $row->uid = $uid;
         $row->apikey = $akey;
         $row->vkey = $vkey;
         $row->status = 1;
         $row->save();
         $this->updateCharacterProfile($uid, $char);
     }
     return $flag;
 }