Skip to content
This repository was archived by the owner on Apr 27, 2022. It is now read-only.

Commit c694d8a

Browse files
authored
parentIdField doc
1 parent ad00252 commit c694d8a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,21 @@ Parent tree models are handled using `parent id` references.
2828

2929
#### Default properties
3030

31-
##### Parent id references
31+
##### Parent primary key (parentIdField)
32+
33+
This property is used to resolve the parent table primary key. If it's null the Eloquent primaryKey model property is used. You can change this value customizing the database field name your table/collection is using. Do this by setting the property calling the `setParentIdField` method in the model `__constructot`:
34+
35+
<?php
36+
...
37+
class MyModel extends Eloquent {
38+
use \Winponta\Treevel\Traits\ParentTreeModel;
39+
40+
public function __construct() {
41+
$this->setParentIdField( 'pk_on_parent_table' );
42+
}
43+
44+
45+
##### Parent references (parentField)
3246

3347
The default field name used by the package to handle the reference value to the parent record is named `parent_id`, you can change this value customizing the database field name your table/collection is using. Do this by setting the property calling the `setParentField` method in the model `__constructot`:
3448

@@ -41,7 +55,7 @@ The default field name used by the package to handle the reference value to the
4155
$this->setParentField( 'my_father_id' );
4256
}
4357

44-
##### Node level property
58+
##### Node level property (levelField)
4559

4660
This property controls the deep level of the node on the tree. The default field value used to handle this feature is named `node_level`, you can change this value customizing the database field name your table/collection is using. Do this by setting the property calling the `setLevelField` method in the model `__constructot`:
4761

0 commit comments

Comments
 (0)