Add findByKey to FieldCollection

This commit is contained in:
philipp lang 2024-04-20 00:00:04 +02:00
parent 5e2427ee81
commit 21dfc4f0b2
1 changed files with 6 additions and 1 deletions

View File

@ -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);
}
/**