You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 27, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+16-2Lines changed: 16 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,21 @@ Parent tree models are handled using `parent id` references.
28
28
29
29
#### Default properties
30
30
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)
32
46
33
47
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`:
34
48
@@ -41,7 +55,7 @@ The default field name used by the package to handle the reference value to the
41
55
$this->setParentField( 'my_father_id' );
42
56
}
43
57
44
-
##### Node level property
58
+
##### Node level property (levelField)
45
59
46
60
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`:
0 commit comments