}
    $view->with('breadcrumbs', $breadcrumbs)->with('additionalBreadcrumbLinks', $additionalBreadcrumbLinks);
});
View::composer('partials.nav_sidebar', function ($view) {
    $root = Collector::get('root');
    $current = Collector::get('current');
    $view->with('root', $root)->with('current', $current);
});
View::composer('partials.popups.sitemap', function ($view) {
    $root = Collector::get('root');
    $current = Collector::get('current');
    $view->with('root', $root)->with('current', $current);
});
View::composer('partials.popups.apply_form_text', function ($view) {
    $oferta = Cache::tags('j_tree')->rememberForever('oferta_' . App::getLocale(), function () {
        return Tree::where('slug', 'oferta')->first();
    });
    $view->with('oferta', $oferta);
});
View::composer(['partials.popups.apply_form', 'partials.popups.new_partner', 'partials.popups.apply_form_deposit', 'partials.popups.apply_form_business'], function ($view) {
    $operatorCodes = explode(',', Settings::get('mobile_operators_codes'));
    $occupations = Cache::tags('occupations')->rememberForever('occupations_' . App::getLocale(), function () {
        return Occupation::active()->get();
    });
    $regions = Cache::tags('regions')->rememberForever('regions_' . App::getLocale(), function () {
        return Region::active()->get();
    });
    $cities = Cache::tags('cities')->rememberForever('cities_region_1_' . App::getLocale(), function () {
        return City::active()->byRegion(1)->get();
    });
    $view->with('occupations', $occupations)->with('operatorCodes', $operatorCodes)->with('regions', $regions)->with('cities', $cities);
示例#2
0
 public function getNode()
 {
     $segments = $segments = explode('/', Request::path());
     $nodeSlug = "";
     //search last segment not url page
     foreach ($segments as $segment) {
         if ($segment != $this->getSlug() . '-' . $this->id) {
             $nodeSlug = $segment;
         }
     }
     if (!$nodeSlug) {
         return false;
     } else {
         return Tree::where("slug", "like", $nodeSlug)->first();
     }
 }
示例#3
0
 public static function getFirstDepthNodes()
 {
     return Tree::where('depth', '1')->get();
 }
示例#4
0
 public function testPaginateWithWhere()
 {
     $connection = m::mock('juicyORM\\Database\\DbConnection');
     $connection->shouldReceive('query')->with('SELECT COUNT(*) AS num_rows FROM "tree" WHERE "type" = ?', array("Deciduous"))->once()->andReturn(array(array('num_rows' => 5)));
     $connection->shouldReceive('query')->with('SELECT * FROM "tree" WHERE "type" = ? LIMIT 0, 2', array("Deciduous"))->once()->andReturn(array($this->fake_tree_table[0]));
     $db = juicyORM\Database\DB::Instance($this->dbConfig, $connection, true);
     $tree = new Tree($db);
     $base_url = 'http://example.com/';
     $user_response = $tree->where('type', '=', 'Deciduous')->paginate(2, 0, $base_url);
     $this->assertEquals(gettype($user_response), 'array');
     $this->assertEquals(gettype($user_response['links']), 'array');
     $this->assertEquals($user_response['links'][0]['href'], $base_url);
     $this->assertEquals($user_response['links'][0]['name'], '1');
     $this->assertEquals($user_response['links'][1]['href'], $base_url . '?page=2');
     $this->assertEquals($user_response['links'][1]['name'], '2');
     $this->assertEquals(gettype($user_response['data']), 'array');
     $this->assertEquals(gettype($user_response['data'][0]), 'object');
     $this->assertEquals(get_class($user_response['data'][0]), 'juicyORM\\Database\\ModelRow');
     $this->assertEquals($user_response['data'][0]->species, 'Oak');
     $this->assertEquals($db->runtime_info(), array(array('sql' => 'SELECT COUNT(*) AS num_rows FROM "tree" WHERE "type" = ?', 'bindings' => array("Deciduous")), array('sql' => 'SELECT * FROM "tree" WHERE "type" = ? LIMIT 0, 2', 'bindings' => array("Deciduous"))));
 }