Hello devs did you know that the team of laravel released conditional validation rule support in their 8.x version. You can see the Pull Request #38361 for implementation details. I am here to show you what is conditional validation rule support in Laravel?
To understand the conditional validation rule support in laravel, see the below code to understand.
request()->validate([ 'name' => 'required|string|min:6', 'password' => [ 'required', 'string', Rule::when(true, ['min:5', 'confirmed']) ], ]);
In the above code example, the
confirmed validation rules only apply when the first argument of
#laravel #laravel-8x #validation