📅  最后修改于: 2022-03-11 14:54:30.480000             🧑  作者: Mango
//Use an if statement to validate some items conditionally:
$request->validate([ //Always validated
'name' => ['string'],
'some_number' => ['numeric', 'integer']
]);
if ($request->email != $user->email) //Validated only if different from user's currently stored email
$request->validate([
'email' => ['email', 'unique:users']
]);