From 2fcbd119a567b41998165ce19b68ac6c65203ce4 Mon Sep 17 00:00:00 2001 From: Hadi Sharghi Date: Thu, 16 May 2024 14:23:41 +0330 Subject: [PATCH] Add method to set parent column name Parent column name can be set if using a custom name for id column. --- src/NestableCollection.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/NestableCollection.php b/src/NestableCollection.php index 6204546..7c22d6c 100644 --- a/src/NestableCollection.php +++ b/src/NestableCollection.php @@ -34,6 +34,13 @@ public function __construct(array $items = []) $this->total = count($items); } + public function parentColumn($name) + { + $this->parentColumn = $name; + + return $this; + } + public function childrenName(string $name): self { $this->childrenName = $name;