Laravel - Validation - Defining Default Password Rules

You may find it convenient to specify the default validation rules for passwords in a single location of your application. You can easily accomplish this using the Password::defaults method, which accepts a closure. The closure given to the defaults method should return the default configuration of the Password rule. Typically, the defaults rule should be called within the boot method of one of your application's service providers:

    use Illuminate\Validation\Rules\Password;
     * Bootstrap any application services.
     * @return void
    public function boot()
        Password::defaults(function () {
            $rule = Password::min(8);
            return $this->app->isProduction()
                        ? $rule->mixedCase()->uncompromised()
                        : $rule;

Then, when you would like to apply the default rules to a particular password undergoing validation, you may invoke the defaults method with no arguments:

    'password' => ['required', Password::defaults()],