Laravel - Validation - Implicit Rules

By default, when an attribute being validated is not present or contains an empty string, normal validation rules, including custom rules, are not run. For example, the unique rule will not be run against an empty string:

    
    use Illuminate\Support\Facades\Validator;
    
    $rules = ['name' => 'unique:users,name'];
    
    $input = ['name' => ''];
    
    Validator::make($input, $rules)->passes(); // true
	

For a custom rule to run even when an attribute is empty, the rule must imply that the attribute is required. To create an "implicit" rule, implement the Illuminate\Contracts\Validation\ImplicitRule interface. This interface serves as a "marker interface" for the validator; therefore, it does not contain any additional methods you need to implement beyond the methods required by the typical Rule interface.

To generate a new implicit rule object, you may use the make:rule Artisan command with the --implicit option :

    
     php artisan make:rule Uppercase --implicit
	
An "implicit" rule only implies that the attribute is required. Whether it actually invalidates a missing or empty attribute is up to you.