laravel 8 validation required if another field is not null

Solutions on MaxInterview for laravel 8 validation required if another field is not null by the best coders in the world

showing results for - "laravel 8 validation required if another field is not null"
Wyatt
03 Jul 2016
1$request->validate([
2  "old_password" =>"nullable",
3  "new_password" =>"confirmed|nullable|different:old_password|required_with:old_password",
4  "password_confirmation" =>"nullable|required_with:new_password|required_with:old_password"
5]);