Skip to content

Commit

Permalink
Update NestableCollection.php
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker authored Nov 8, 2021
1 parent f98feb3 commit b1acce4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/NestableCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace TypiCMS;

use App;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection as BaseCollection;
Expand Down Expand Up @@ -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;
Expand All @@ -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
*/
Expand Down Expand Up @@ -214,6 +213,7 @@ public function getTotal()
public function setParents()
{
$this->setParentsRecursive($this);

return $this;
}

Expand Down

0 comments on commit b1acce4

Please sign in to comment.