zip can start with 0 , example 01415000 , so it can not have numeric
and size:8
together and will never have eight numbers if you start with 0 .
So the ideal for validation would be digits : 8 : This validation works by verifying that all are numbers and that the number quantity is equal to 8 including 0.
$rules= ['cep' => 'required|digits:8'];
If you want to create a validation with your own code follow the example below:
Registering a validation:
Validator::extend('cep', function($attribute, $value, $parameters, $validator) {
return mb_strlen($value) === 8 && preg_match('/^(\d){8}$/', $value)
});
$rules= ['cep' => 'required|cep'];
In this respect, validation will work your way. In this link , the validations are the Laravel has for version 5.2 and 5.3 so far.