Skip to content

Commit

Permalink
Update HasCharacterLimit.php
Browse files Browse the repository at this point in the history
Fix: Respect maxLength in combination with characterLimit
  • Loading branch information
schmeits committed May 29, 2024
1 parent 9c0fd2a commit 5810340
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Forms/Concerns/HasCharacterLimit.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ public function characterLimit(int | Closure | null $value = null): self

public function getCharacterLimit(): ?int
{
if ($this->maxLength) {
$character_limit = (int) $this->evaluate($this->characterLimit);

if ($this->maxLength && $character_limit === 0) {
return $this->getMaxLength();
}

return (int) $this->evaluate($this->characterLimit);
return $character_limit;
}
}

0 comments on commit 5810340

Please sign in to comment.