public function getCitiesByRegion() { $idRegion = trim(Input::get('id_region')) ?: 0; $cities = Cache::tags('cities')->rememberForever('cities_region_' . $idRegion . '_' . App::getLocale(), function () use($idRegion) { return City::active()->byRegion($idRegion)->get(); }); $html = View::make('partials.popups.partials.select_city', compact('cities'))->render(); return Response::json(array('status' => true, 'html' => $html)); }
} $view->with('nextPage', $nextPage)->with('firstPage', $firstPage); }); View::composer('partials.cards_compare', function ($view) { if (!Request::ajax()) { $cardsIds = Tree::getCardsCompared(); $cardsCompared = null; if ($cardsIds) { $cardsCompared = Tree::with('card')->whereIn('id', $cardsIds)->active()->get(); } $view->with('cardsCompared', $cardsCompared); } }); View::composer('partials.calculators.consumer', function ($view) { $cities = Cache::tags('cities')->rememberForever('cities_' . App::getLocale(), function () { return City::active()->get(); }); $shops = Cache::tags('shops')->rememberForever('shops_' . App::getLocale(), function () { return Shop::active()->get(); }); $products = Cache::tags('products')->rememberForever('products_' . App::getLocale(), function () { return Product::active()->get(); }); $view->with('cities', $cities)->with('shops', $shops)->with('products', $products); }); View::composer('partials.calculators.cards', function ($view) { $programs = Cache::tags('j_tree', 'cards_programs')->rememberForever('privates_cards_programs_' . App::getLocale(), function () { return CardProgram::active()->get(); }); $cards = Cache::tags('j_tree', 'cards')->rememberForever('privates_cards_' . App::getLocale(), function () { $cardsCatalog = Tree::find(Collector::get('idCardsCatalog'));
public function scopeBySearchPhrase($query, $phrase) { $phrase = trim($phrase); if (!$phrase) { return $query; } // by city name $citiesIds = City::active()->searchByTitle($phrase)->lists('id'); if ($citiesIds) { return $query->byCity($citiesIds); } // by metro station $officesIds = Office::active()->searchByMetro($phrase)->lists('id'); if ($officesIds) { return $query->whereIn('id', $officesIds); } // by address return $query->byAddress($phrase); }