diff --git a/app/Form/Data/FieldCollection.php b/app/Form/Data/FieldCollection.php index 3c6c6d7b..73742ca3 100644 --- a/app/Form/Data/FieldCollection.php +++ b/app/Form/Data/FieldCollection.php @@ -70,7 +70,12 @@ class FieldCollection extends Collection public function find(Field $givenField): ?Field { - return $this->first(fn ($field) => $field->key === $givenField->key); + return $this->findByKey($givenField->key); + } + + public function findByKey(string $key): ?Field + { + return $this->first(fn ($field) => $field->key === $key); } /**