Skip to content

Instantly share code, notes, and snippets.

@raank
Last active February 27, 2019 20:58
Show Gist options
  • Save raank/6cb7652a896da916c98216e5553092e8 to your computer and use it in GitHub Desktop.
Save raank/6cb7652a896da916c98216e5553092e8 to your computer and use it in GitHub Desktop.
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class Uppercase implements Rule
{
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
$cpf = str_replace(['.', '-'] , '', $value);
return funcao_que_valida_CPF($cpf);
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return 'The :attribute must be uppercase.';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment