/** * @param RelationshipInterface $relationship * @param $record */ protected function hydrateUserRelationship(RelationshipInterface $relationship, $record) { $record->user_id = $relationship->getIdentifier()->getId(); }
/** * Hydrate a resource has-one relationship. * * @param $resourceKey * @param RelationshipInterface $relationship * @param Model $model * @return bool * whether a relationship was hydrated */ protected function hydrateHasOne($resourceKey, RelationshipInterface $relationship, Model $model) { $relation = $this->getRelation($resourceKey, $model); if (!$relation instanceof BelongsTo) { return false; } if ($relationship->hasIdentifier()) { $relation->associate($this->findRelated($relationship->getIdentifier())); } else { $relation->dissociate(); } return true; }