Answers for "laravel required if other field not null"

PHP
1

laravel 8 validation required if another field is not null

$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"
]);
Posted by: Guest on September-22-2021
0

input if not null laravel

public function store(Request $request)
{
    if($request->has('user_id')) {
        dd('user_id is exists.');
    } else {
        dd('user_id is not exists.');
    }
}
Posted by: Guest on November-18-2021

Code answers related to "laravel required if other field not null"

Browse Popular Code Answers by Language