Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion database/traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,15 @@ $user->setSortableOrder([1, 2, 3], [3, 2, 1]);

## Simple Tree

A simple tree model will use the `parent_id` column maintain a parent and child relationship between models. To use the simple tree, apply the `Winter\Storm\Database\Traits\SimpleTree` trait.
A simple tree model will use the `parent_id` column maintain a parent and child relationship between models. To add the `parent_id` column to your table, you may use the `unsignedInteger` method inside a migration.

```php
Schema::table('categories', function ($table) {
$table->unsignedInteger('parent_id')->nullable();
});
```

To use the simple tree, apply the `Winter\Storm\Database\Traits\SimpleTree` trait.

```php
class Category extends Model
Expand Down