I want to validate some inputs of Laravel5.1 application to be fill not require meaning,its not require to an attribute was sent but if was sent,its value could not be empty string,what is your solution? Of course I used filled rule but its useless and if value of input is empty it can not be validate attribute
I follow track of Laravel validation and I found if value of an input is empty string Laravel does not validate its value except some rules in implicit array (such as required, requiredWith,..) so other validation (such as filled,..) can not run if value of attribute is empty string , I try to add fill validator to implicit array so I create a service provider class and extend implicite array that is located in Validator.php in Validtion package in Laravel Illuminate
class ValidatorServiceProvider extends ServiceProvider{
public function boot()
{
$this->app['validator']->extendImplicit('Filled', function($attribute, $value, $parameters, $validator) {
return $value == 'Filled';
});}
so when I add filled rule for an attribute, if attribute was sent it could not be empty
$rules = ['email' => 'filled|email]