src/Franzose/ClosureTable/Models/Entity.php
public function addChildren(array $children)
    {
        if ($this->exists) {
            \DB::connection($this->connection)->transaction(function () use ($children) {
                $lastChildPosition = $this->getLastChildPosition();

                foreach ($children as $child) {
                    if (!$child instanceof EntityInterface) {
                        if (isset($child['id'])) {
                            unset($child['id']);
                        }

                        $child = new static($child);
                    }

                    $this->addChild($child, $lastChildPosition);
                    $lastChildPosition++;
                }
            });
        }

        return $this;
    }
public function addChildren(array $children)
    {
        if ($this->exists) {
            \DB::connection($this->connection)->transaction(function () use ($children) {
                $lastChildPosition = $this->getLastChildPosition();

                foreach ($children as $child) {
                    if (!$child instanceof EntityInterface) {
                        if (isset($child['id'])) {
                            unset($child['id']);
                        }

                        $child = new static($child);
                    }

                    $this->addChild($child, $lastChildPosition);
                    $lastChildPosition++;
                }
            });
        }

        return $this;
    }
public function addChildren ( array $ children ) { if ( $ this -> exists ) { \ DB :: connection ( $ this -> connection ) -> transaction ( function ( ) use ( $ children ) { $ lastChildPosition = $ this -> getLastChildPosition ( ) ; foreach ( $ children as $ child ) { if ( ! $ child instanceof EntityInterface ) { if ( isset ( $ child [ 'id' ] ) ) { unset ( $ child [ 'id' ] ) ; } $ child = new static ( $ child ) ; } $ this -> addChild ( $ child , $ lastChildPosition ) ; $ lastChildPosition ++ ; } } ) ; } return $ this ; }
Appends a collection of children to the model.

@param array $children
@return $this
@throws \InvalidArgumentException
Appends a collection of children to the model .