From b1acce474c2ef5ba2670540b457292ecae1c41ca Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Mon, 8 Nov 2021 15:17:52 +0100 Subject: [PATCH] Update NestableCollection.php --- src/NestableCollection.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/NestableCollection.php b/src/NestableCollection.php index 38cba8b..bd49bd0 100644 --- a/src/NestableCollection.php +++ b/src/NestableCollection.php @@ -9,7 +9,6 @@ namespace TypiCMS; -use App; use Illuminate\Database\Eloquent\Collection; use Illuminate\Support\Arr; use Illuminate\Support\Collection as BaseCollection; @@ -78,7 +77,7 @@ public function nest() } // Add items to children collection. - foreach ($collection->items as $key => $item) { + foreach ($collection->items as $item) { if ($item->{$parentColumn} && isset($collection[$item->{$parentColumn}])) { $collection[$item->{$parentColumn}]->{$this->childrenName}->push($item); $keysToDelete[] = $item->id; @@ -95,11 +94,11 @@ public function nest() * Recursive function that flatten a nested Collection * with characters (default is four spaces). * - * @param string $column - * @param int $level - * @param array &$flattened - * @param string|null $indentChars - * @param string|boolen|null $parent_string + * @param string $column + * @param int $level + * @param array &$flattened + * @param null|string $indentChars + * @param null|bool|string $parent_string * * @return array */ @@ -214,6 +213,7 @@ public function getTotal() public function setParents() { $this->setParentsRecursive($this); + return $this; }