Exemple #1
0
 function create()
 {
     $_S =& new AppSettings();
     if ($_S->isEnabled("enableUserSearch")) {
         parent::create();
     }
 }
 public function saved()
 {
     $input = Input::all();
     $sessionId = Common::checkSessionLogin($input);
     $inputSearch = ['name' => $input['name'], 'user_id' => $input['user_id'], 'price_id' => $input['price_id'], 'category_id' => $input['category_id'], 'type_id' => $input['type_id'], 'time_id' => $input['time_id'], 'city_id' => $input['city_id'], 'city' => Common::getModelField($input['city_id'], 'City', 'name'), 'lat' => $input['lat'], 'long' => $input['long']];
     Search::create($inputSearch);
     return Common::returnData(200, SUCCESS, $input['user_id'], $sessionId);
 }
Exemple #3
0
 public function run()
 {
     Search::create(['label' => '阿登成人专场', 'count' => 12]);
     Search::create(['label' => '武辉成人专场', 'count' => 1434]);
     Search::create(['label' => '裕源成人专场', 'count' => 344]);
     Search::create(['label' => '壁鸿成人专场', 'count' => 112]);
     Search::create(['label' => '坚哥成人专场', 'count' => 888]);
     Search::create(['label' => '电影', 'count' => 88]);
     Search::create(['label' => '牛人', 'count' => 1188]);
     Search::create(['label' => '海贼王', 'count' => 17]);
     Search::create(['label' => '面包', 'count' => 166]);
     Search::create(['label' => '牛奶', 'count' => 14]);
     Search::create(['label' => '咖啡', 'count' => 1]);
 }
 public function search()
 {
     $search_term = Input::get('search_term');
     if (isset($search_term) && $search_term != '') {
         $search_query = '%' . $search_term . '%';
         $politicians = Politician::where('full_name', 'like', $search_query)->orWhere('party', 'like', $search_query)->orWhere('state', 'like', $search_query)->orWhere('city', 'like', $search_query)->orWhere('office', 'like', $search_query)->orWhere('sex', 'like', $search_query)->orWhere('bio', 'like', $search_query)->orWhere('district', 'like', $search_query)->get();
         if ($politicians->count() == 0) {
             $politicians = null;
         }
         $users = User::where('username', 'like', $search_query)->orWhere('first_name', 'like', $search_query)->orWhere('last_name', 'like', $search_query)->orWhere('email', 'like', $search_query)->orWhere('party', 'like', $search_query)->orWhere('state', 'like', $search_query)->orWhere('city', 'like', $search_query)->get();
         if ($users->count() == 0) {
             $users = null;
         }
         $issue = Issue::where('issue_name', '=', $search_term)->first();
         //don't want to repeat same articles in issue and in news.
         //don't want to do unnescesarry google news calls either
         //either news or issues
         if ($issue == null) {
             $news = $this->gNews($search_term);
         } else {
             $news = null;
         }
         $found = !($issue == null && $politicians == null && $news == null && $users == null);
         $user_id = Auth::check() ? Auth::user()->id : 0;
         //we're saving search attempts for study later. who searches and wether results are given.
         $search = Search::create(array('search_term' => $search_term, 'found' => $found, 'user_id' => $user_id));
         $search->save();
     } else {
         $politicians = null;
         $issue = null;
         $news = null;
         $users = null;
     }
     return View::make('results')->with('politicians', $politicians)->with('news', $news)->with('users', $users)->with('issue', $issue);
 }
 public function run()
 {
     Search::create(['name' => 'Xe máy Yamaha', 'user_id' => '1', 'price_id' => '3', 'category_id' => '3', 'type_id' => '1', 'time_id' => '1', 'lat' => '21.00296184', 'long' => '105.85202157']);
     Search::create(['name' => 'Máy ảnh', 'user_id' => '1', 'price_id' => '2', 'category_id' => '5', 'type_id' => '1', 'time_id' => '1', 'lat' => '21.00296184', 'long' => '105.85202157']);
 }