Support the ongoing development of Laravel.io →
Laravel Validation
Last updated 2 years ago.
0

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

0

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.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Nick beagoodlearner Joined 13 Jun 2018

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.