- Added support for field value in Where attribute

This commit is contained in:
Dave Mc Nicoll committed 2023-02-23 12:15:31 -05:00
1 parent c9c6a11ebd
commit c6bfaa05f2
3 files changed
+16 -19

No files matched your search

+1 -4
View File
@@ -152,7 +152,7 @@ class RelationBuilder
$this->repository->open();
foreach($this->wheres as $condition) {
$this->repository->where($condition->field, is_callable($condition->value) ? call_user_func_array($condition->value, [ $this->entity ]) : $condition->value, $condition->operator);
$this->repository->where($condition->field, is_callable($condition->value) ? call_user_func_array($condition->value, [ $this->entity ]) : $condition->getValue(), $condition->operator);
}
$this->repository->close();
@@ -262,9 +262,6 @@ class RelationBuilder
$field = $relation->key;
if ($relation->foreignKey) {
# dump($baseEntity::resolveEntity()->searchField($field));
# dump($this->resolver->properties[$name], $field);
$value = ! is_string($field) && is_callable($field) ? $field($this->entity) : $this->entity->$field;
$this->repository->where( is_object($relation->foreignKey) ? $relation->foreignKey : $baseEntity::field($relation->foreignKey), $value );
}