fix validator
This commit is contained in:
1 parent
60446ea760
commit
7270b50da2
1 file changed
+15
-14
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Hekmatinasser\Verta\Laravel;
|
namespace Hekmatinasser\Verta\Laravel;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Hekmatinasser\Verta\Verta;
|
use Hekmatinasser\Verta\Verta;
|
||||||
|
|
||||||
class JalaliValidator
|
class JalaliValidator
|
||||||
@@ -22,7 +23,7 @@ class JalaliValidator
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Verta::parseFormat($format, $value);
|
Verta::parseFormat($format, $value);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ class JalaliValidator
|
|||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
|
|
||||||
return Verta::parseFormat($format, $value)->eq($base);
|
return Verta::parseFormat($format, $value)->eq($base);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,7 +73,7 @@ class JalaliValidator
|
|||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
|
|
||||||
return Verta::parseFormat($format, $value)->ne($base);
|
return Verta::parseFormat($format, $value)->ne($base);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +95,7 @@ class JalaliValidator
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Verta::parseFormat($format, $value);
|
Verta::parseFormat($format, $value);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ class JalaliValidator
|
|||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
|
|
||||||
return Verta::parseFormat($format, $value)->eq($base);
|
return Verta::parseFormat($format, $value)->eq($base);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,7 +145,7 @@ class JalaliValidator
|
|||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
|
|
||||||
return Verta::parseFormat($format, $value)->ne($base);
|
return Verta::parseFormat($format, $value)->ne($base);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,7 +169,7 @@ class JalaliValidator
|
|||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
|
|
||||||
return Verta::parseFormat($format, $value)->gt($base);
|
return Verta::parseFormat($format, $value)->gt($base);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,7 +193,7 @@ class JalaliValidator
|
|||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
|
|
||||||
return Verta::parseFormat($format, $value)->gte($base);
|
return Verta::parseFormat($format, $value)->gte($base);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,7 +217,7 @@ class JalaliValidator
|
|||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
|
|
||||||
return Verta::parseFormat($format, $value)->gt($base);
|
return Verta::parseFormat($format, $value)->gt($base);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,7 +241,7 @@ class JalaliValidator
|
|||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
|
|
||||||
return Verta::parseFormat($format, $value)->gte($base);
|
return Verta::parseFormat($format, $value)->gte($base);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -264,7 +265,7 @@ class JalaliValidator
|
|||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
|
|
||||||
return Verta::parseFormat($format, $value)->lt($base);
|
return Verta::parseFormat($format, $value)->lt($base);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -288,7 +289,7 @@ class JalaliValidator
|
|||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
|
|
||||||
return Verta::parseFormat($format, $value)->lte($base);
|
return Verta::parseFormat($format, $value)->lte($base);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,7 +313,7 @@ class JalaliValidator
|
|||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
|
|
||||||
return Verta::parseFormat($format, $value)->lt($base);
|
return Verta::parseFormat($format, $value)->lt($base);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,7 +337,7 @@ class JalaliValidator
|
|||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
|
|
||||||
return Verta::parseFormat($format, $value)->lte($base);
|
return Verta::parseFormat($format, $value)->lte($base);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user