The simplest way to traverse the hierarchy tree with Baum is by iterating through the children relation.
<?php
$root = Category::roots()->with('children')->first();
echo "<h3>{$root->name}</h3>";
foreach($root->children as $category) {| #!/bin/bash | |
| BUNDLED_COMMANDS="${BUNDLED_COMMANDS:- | |
| cap | |
| capify | |
| cucumber | |
| foreman | |
| guard | |
| haml | |
| heroku |
| /* | |
| * Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js | |
| */ | |
| var http = require('http'), | |
| fs = require('fs'), | |
| util = require('util'); | |
| http.createServer(function (req, res) { | |
| var path = 'video.mp4'; |
The simplest way to traverse the hierarchy tree with Baum is by iterating through the children relation.
<?php
$root = Category::roots()->with('children')->first();
echo "<h3>{$root->name}</h3>";
foreach($root->children as $category) {| # db/migrate/XXXXXXXXXXXXX_add_authentication_token_to_users.rb | |
| class AddAuthenticationTokenToUsers < ActiveRecord::Migration | |
| def change | |
| add_column :users, :authentication_token, :string | |
| add_index :users, :authentication_token, :unique => true | |
| end | |
| end |
| <?php | |
| require __DIR__ . '/vendor/autoload.php'; | |
| use Illuminate\Database\Capsule\Manager as DB; | |
| use Baum\Node; | |
| // Initialize Capsule | |
| $capsule = new DB; | |
| // Add connection settings |
| <?php | |
| require __DIR__ . '/vendor/autoload.php'; | |
| use Illuminate\Database\Capsule\Manager as DB; | |
| use Baum\Node; | |
| // Initialize Capsule | |
| $capsule = new DB; | |
| // Add connection settings |