📜  如果另一个字段不为空,则需要 laravel 8 验证 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:02.675000             🧑  作者: Mango

代码示例1
$request->validate([
  "old_password" =>"nullable",
  "new_password" =>"confirmed|nullable|different:old_password|required_with:old_password",
  "password_confirmation" =>"nullable|required_with:new_password|required_with:old_password"
]);