本文整理汇总了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);
示例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();
}
}
示例3: getFirstDepthNodes
public static function getFirstDepthNodes()
{
return Tree::where('depth', '1')->get();
}
示例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"))));
}