예제 #1
0
 /**
  * Get Values relationship.
  *
  * @return Values
  */
 public function values(Collection $properties = null)
 {
     $instance = new Value();
     $instance->setConnection($this->getConnectionName());
     //Builder $query, Model $parent, $foreignKey, $localKey
     return new Values($instance->newQuery(), $this, $instance->getTable() . '.entity_id', $this->getKeyName(), $properties);
 }
예제 #2
0
 /**
  * Get relation for value.
  *
  * @param string $key
  *
  * @return Relations\Values
  */
 public function getValueRelation($key)
 {
     $property = $this->getProperties()->get($key);
     $instance = new Value();
     $instance->setConnection($this->entity->getConnectionName());
     //Builder $query, Model $parent, $foreignKey, $localKey
     return new Relations\Values($instance->newQuery(), $this->entity, $instance->getTable() . '.entity_id', $this->entity->getKeyName(), new Collection([$property]));
 }