-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[8.x] Add ability to define default Password Rule #37387
Conversation
This will make it easier to define a generic default password rules for login, register and password reset and useful for Laravel UI, Breeze, Jetstream and Nova. Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Co-authored-by: Dries Vints <dries.vints@gmail.com>
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Would be cool if you could do: Password::default()->required(); Or even: Password::required() Which will apply the default by default 😅 |
Password::required() I really liking this, |
``` 1) Warning Test method "testRule" in test class "Illuminate\Tests\Validation\ValidationPasswordRuleTest" is not public. ``` Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
So, if you use 'name' => ['required', 'string'],
'password' => [...Password::required(), 'foo', 'bar'], |
@taylorotwell yes, that's the plan with returning it as Was tempting to do the following, but not sure if it's wise public static function __callStatic($method, $parameters)
{
return [$method, static::default()];
} |
Hi, did you just forget |
Intentionally leave it out, you can do |
This will make it easier to define a generic default password rules for login, register and password reset and useful for Laravel UI, Breeze, Jetstream and Nova.
Defining Rules
Typically on the
App\Providers\AuthServiceProvider
Using the rules
E.g in Laravel Nova.
Also, you can use:
Signed-off-by: Mior Muhammad Zaki crynobone@gmail.com