當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tree::where方法代碼示例

本文整理匯總了PHP中Tree::where方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tree::where方法的具體用法?PHP Tree::where怎麽用?PHP Tree::where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tree的用法示例。


在下文中一共展示了Tree::where方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: function

    }
    $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);
開發者ID:OlesKashchenko,項目名稱:SkillsProject1,代碼行數:31,代碼來源:view_composers.php

示例2: getNode

 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();
     }
 }
開發者ID:arturishe21,項目名稱:buider,代碼行數:16,代碼來源:BaseModel.php

示例3: getFirstDepthNodes

 public static function getFirstDepthNodes()
 {
     return Tree::where('depth', '1')->get();
 }
開發者ID:OlesKashchenko,項目名稱:SkillsProject1,代碼行數:4,代碼來源:Tree.php

示例4: testPaginateWithWhere

 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"))));
 }
開發者ID:nkalush,項目名稱:orm,代碼行數:21,代碼來源:ORMVersionTwoTest.php


注:本文中的Tree::where方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。