Skip to content

Commit

Permalink
Fix postgresql create on call is_unique via API
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed May 2, 2020
1 parent 7edf31b commit f84e2f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion system/Validation/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,12 @@ public function is_unique(string $str = null, string $field, array $data): bool
->where($field, $str)
->limit(1);

if (! empty($ignoreField) && ! empty($ignoreValue))
if (! empty($ignoreField)
&& ! empty($ignoreValue)
&& strpos($ignoreValue, '{') !== 0
&& substr($ignoreValue, -1) !== '}'
&& $ignoreField !== $ignoreValue
)
{
$row = $row->where("{$ignoreField} !=", $ignoreValue);
}
Expand Down

0 comments on commit f84e2f6

Please sign in to comment.