Skip to content

Commit 1cd86c2

Browse files
committed
Update README.markdown
1 parent c7678b8 commit 1cd86c2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

README.markdown

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ The package can be installed as Composer package, just include it into
1313

1414
## Basic usage
1515

16+
### Schema
17+
1618
Storing trees in database requires additional columns for the table, so these
1719
fields need to be included in table schema. We use `NestedSet::columns($table)`
1820
inside table schema creation function, like so:
@@ -60,15 +62,20 @@ class CreateCategoriesTable extends Migration {
6062

6163
To simplify things root node is required. `NestedSet::createRoot` creates it for us.
6264

65+
### The model
66+
6367
The next step is to create `Eloquent` model. Do it whatever way you like, but
64-
make shure that node is extended from `\Kalnoy\Nestedset\Node`, like here:
68+
make shure that model is extended from `\Kalnoy\Nestedset\Node`, like here:
6569

6670
```php
6771
<?php
6872

6973
class Category extends \Kalnoy\Nestedset\Node {}
7074
```
71-
Now you can create nodes like so:
75+
76+
### Queries
77+
78+
You can create nodes like so:
7279

7380
```php
7481
$node = new Category(array('title' => 'TV\'s'));

0 commit comments

Comments
 (0)