This commit is contained in:
23
api/app/Rules/Apac/CodigoEmissor.php
Normal file
23
api/app/Rules/Apac/CodigoEmissor.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules\Apac;
|
||||
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class CodigoEmissor implements Rule
|
||||
{
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
return self::isValid($value);
|
||||
}
|
||||
|
||||
public static function isValid($value)
|
||||
{
|
||||
return !is_null($value) && strlen($value) === 10;
|
||||
}
|
||||
|
||||
public function message()
|
||||
{
|
||||
return 'Código do emissor inválido.';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user