Files
Antonio Lopes dos Santos afec302c3e
All checks were successful
build-api-image / build (push) Successful in 51s
init commit
2026-08-04 16:52:02 -03:00

36 lines
646 B
PHP

<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class Cep implements Rule
{
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
self::isValid($value);
}
public static function isValid($value)
{
return !is_null($value) && strlen($value) === 8 && $value !== '00000000';
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return 'CEP inválido.';
}
}