xxxxxxxxxx
$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"
]);
Use "required_without" or "exclude_if" to make sure to validate input if another input is not null
xxxxxxxxxx
// Validate crosslinked inputs
$request->validate([
'user_check' => ['required_without:menu_check'],
'menu_check' => ['required_without:user_check'],
], [
'required_without' => 'At least one input has to be filled',
]);
// Validate inputs (OLD)
$request->validate([
'title' => ['exclude_if:event_banner,null', 'required'],
'desc' => ['exclude_if:content_banner,null', 'required'],
], [
'required' => 'Input must not be empty',
]);