mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix #9914
This commit is contained in:
@@ -31,6 +31,14 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class IsValidZeroOrMoreAmount implements ValidationRule
|
||||
{
|
||||
private bool $nullable = false;
|
||||
|
||||
public function __construct(bool $nullable = false)
|
||||
{
|
||||
$this->nullable = $nullable;
|
||||
}
|
||||
|
||||
|
||||
use ValidatesAmountsTrait;
|
||||
|
||||
/**
|
||||
@@ -38,6 +46,9 @@ class IsValidZeroOrMoreAmount implements ValidationRule
|
||||
*/
|
||||
public function validate(string $attribute, mixed $value, \Closure $fail): void
|
||||
{
|
||||
if (true === $this->nullable && null === $value) {
|
||||
return;
|
||||
}
|
||||
$value = (string) $value;
|
||||
// must not be empty:
|
||||
if ($this->emptyString($value)) {
|
||||
|
Reference in New Issue
Block a user