you may be use like this to validate By default, when an attribute being validated is not present or contains an empty value as defined by the required rule, normal validation rules, including custom extensions, are not run. For example, the unique rule will not be run against a null value:
$rules = ['name' => 'unique'];
$input = ['name' => null];
Validator::make($input, $rules)->passes(); // true
For a rule to run even when an attribute is empty, the rule must imply that the attribute is required. To create such an "implicit" extension, use the Validator::extendImplicit() method:
Validator::extendImplicit('foo', function ($attribute, $value, $parameters, $validator) {
return $value == 'foo';
});
more information : https://laravel.com/docs/5.6/validation
what are you doing? What is the use of copying the contents of the manual? If you can't help me, please don't reply to these worthless answers.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community