etrepat / baum

Baum is an implementation of the Nested Set pattern for Laravel's Eloquent ORM.
http://etrepat.com/baum
MIT License
2.24k stars 459 forks source link

Change default key from `id` to another column #336

Open rasadeghnasab opened 4 years ago

rasadeghnasab commented 4 years ago

I have a table which has these columns:

id, user_id, parent_id, sport_id

I want to create children using user_id column instead of id. for example:

id      user_id      parent_id       sport_id
1    20       null      2
2    25       20        2   # user#20 is user#25 parent.
3    28       25        2   # user#25 is user#28 parent.
4    29       20        2   # user#20 is user#29 parent.

please tell me what should I do?