public function saveAsChildOf($parent)
	{
		$this->establishIsModel($parent)
		     ->establishBaseParametersFromParent($parent);

		// Compute the location where the item should reside
		$this->set('lft', $parent->rgt);
		$this->set('rgt', $parent->rgt + 1);

		// Save
		if (!$this->save())
		{
			return false;
		}

		// Reposition new values of displaced items
		$this->resolveTrailing($parent->rgt);

		return true;
	}
public function saveAsChildOf($parent)
	{
		$this->establishIsModel($parent)
		     ->establishBaseParametersFromParent($parent);

		// Compute the location where the item should reside
		$this->set('lft', $parent->rgt);
		$this->set('rgt', $parent->rgt + 1);

		// Save
		if (!$this->save())
		{
			return false;
		}

		// Reposition new values of displaced items
		$this->resolveTrailing($parent->rgt);

		return true;
	}
public function saveAsChildOf ( $ parent ) { $ this -> establishIsModel ( $ parent ) -> establishBaseParametersFromParent ( $ parent ) ; // Compute the location where the item should reside $ this -> set ( 'lft' , $ parent -> rgt ) ; $ this -> set ( 'rgt' , $ parent -> rgt + 1 ) ; // Save if ( ! $ this -> save ( ) ) { return false ; } // Reposition new values of displaced items $ this -> resolveTrailing ( $ parent -> rgt ) ; return true ; }
Saves the current model to the database as the nth child of the given parent

@param   object|int  $parent  The parent of the child being created
@return  bool
@since   2.1.0
Saves the current model to the database as the nth child of the given parent