本文整理汇总了PHP中Node::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::all方法的具体用法?PHP Node::all怎么用?PHP Node::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Node
的用法示例。
在下文中一共展示了Node::all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: allLevelUp
public static function allLevelUp($excellent = false)
{
$nodes = Node::all();
$result = array();
foreach ($nodes as $key => $node) {
if ($node->parent_node == null) {
$result['top'][] = $node;
} else {
if ($excellent) {
$node->excellent && ($result['second'][$node->parent_node][] = $node);
} else {
$result['second'][$node->parent_node][] = $node;
}
}
}
return $result;
}
示例2: allLevelUp
public static function allLevelUp()
{
return Cache::remember(self::CACHE_KEY, self::CACHE_MINUTES, function () {
$nodes = Node::all();
$result = array();
foreach ($nodes as $key => $node) {
if ($node->parent_node == null) {
$result['top'][] = $node;
foreach ($nodes as $skey => $snode) {
if ($snode->parent_node == $node->id) {
$result['second'][$node->id][] = $snode;
}
}
}
}
return $result;
});
}
示例3: array
<h2>Add Menu Item</h2>
<p>Adding to menu <?php
echo $this->model->name;
?>
</p>
<form action="/menu_item/create" method="POST">
<?php
echo $this->input_for('menu_id', '', array('type' => 'hidden', 'value' => $this->model->id));
echo $this->input_for('name', 'Name');
?>
<hr />
<?php
echo $this->input_for('url', 'Enter a URL');
?>
<p><strong>OR</strong></p>
<?php
echo $this->input_for('node_id', 'Choose existing content', array('type' => 'list', 'options' => $this->model_options(Node::all(), 'id', '{title} - {type} - {slug}')));
?>
<hr />
<?php
echo $this->input_for('parent_id', 'Parent', array('type' => 'list', 'options' => $this->model_options($this->model->all_items, 'id', 'name')));
?>
<input type="submit" value="Save" />
</form>
示例4: index
public function index()
{
$nodes = Node::all();
return View::make('nodes.index', compact('nodes'));
}