Skip to content

Commit

Permalink
Fix Filament validation key (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvermeyen committed Mar 11, 2024
1 parent 4c44849 commit 3b858a9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/UniqueTranslationValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class UniqueTranslationValidator
* @return bool
*/
public function validate($attribute, $value, $parameters, $validator)
{
list ($name, $locale) = $this->isNovaTranslation($attribute)
{
list ($name, $locale) = $this->isNovaTranslation($attribute)
? $this->getNovaAttributeNameAndLocale($attribute)
: (
$this->isFilamentTranslation($attribute)
? $this->getFilamentAttributeNameAndLocale($attribute)
$this->isFilamentTranslation($attribute)
? $this->getFilamentAttributeNameAndLocale($attribute)
: $this->getArrayAttributeNameAndLocale($attribute)
);

Expand Down Expand Up @@ -113,7 +113,7 @@ protected function isFilamentTranslation($attribute)
protected function getFilamentAttributeNameAndLocale($attribute)
{
$attribute = str_replace('data.', '', $attribute);
@list($locale, $name) = @explode('.', $attribute);
@list($name, $locale) = @explode('.', $attribute);
return [$name, $locale];
}

Expand Down Expand Up @@ -240,7 +240,7 @@ protected function isUnique($value, $name, $locale, $parameters)
$query = $this->findTranslation($connection, $table, $column, $locale, $value);
$query = $this->ignore($query, $ignoreColumn, $ignoreValue);
$query = $this->addConditions($query, $this->getUniqueExtra($parameters));

$isUnique = $query->count() === 0;

return $isUnique;
Expand Down

0 comments on commit 3b858a9

Please sign in to comment.