public function createRelationship($target, $firstLabel = null, $secondLabel = null) { if ($this->isValidTarget($target)) { $relationship = new Relationships(); $relationship->firstType = get_class($this->owner); $relationship->firstId = $this->owner->id; $relationship->firstLabel = $firstLabel; $relationship->secondType = get_class($target); $relationship->secondId = $target->id; $relationship->secondLabel = $secondLabel; if ($relationship->save()) { return true; } else { return $relationship->getAllErrorMessages(); } } return false; }