diff --git a/src/NovaDependencyContainer.php b/src/NovaDependencyContainer.php index e8157e3..fda4b66 100644 --- a/src/NovaDependencyContainer.php +++ b/src/NovaDependencyContainer.php @@ -153,28 +153,30 @@ public function resolveForDisplay($resource, $attribute = null) $this->meta['dependencies'][$index]['satisfied'] = false; - if (array_key_exists('empty', $dependency) && empty($resource->{$dependency['property']})) { + $value = $this->resolveAttribute($resource, $dependency['property']); + + if (array_key_exists('empty', $dependency) && empty($value)) { $this->meta['dependencies'][$index]['satisfied'] = true; continue; } // inverted `empty()` - if (array_key_exists('notEmpty', $dependency) && !empty($resource->{$dependency['property']})) { + if (array_key_exists('notEmpty', $dependency) && !empty($value)) { $this->meta['dependencies'][$index]['satisfied'] = true; continue; } // inverted - if (array_key_exists('nullOrZero', $dependency) && in_array($resource->{$dependency['property']}, [null, 0, '0'], true)) { + if (array_key_exists('nullOrZero', $dependency) && in_array($value, [null, 0, '0'], true)) { $this->meta['dependencies'][$index]['satisfied'] = true; continue; } - if (array_key_exists('not', $dependency) && $resource->{$dependency['property']} != $dependency['not']) { + if (array_key_exists('not', $dependency) && $value != $dependency['not']) { $this->meta['dependencies'][$index]['satisfied'] = true; continue; } if (array_key_exists('value', $dependency)) { - if ($dependency['value'] == $resource->{$dependency['property']}) { + if ($dependency['value'] == $value) { $this->meta['dependencies'][$index]['satisfied'] = true; continue; }