I have an error that says
Validation rule date_format requires at least 1 parameters.
Then this is my Code under RegisteredUserController.php
public function store(Request $request): RedirectResponse
{
$request->validate([
'first_name' => ['required', 'string', 'max:255'],
'last_name'=>['required','string','max:255'],
'sex'=>['required','string','max:10'],
'birthdate'=>['required','date_format'],
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class],
'password' => ['required', 'confirmed', RulesPassword::defaults()],
]);
$user = User::create([
'first_name' => $request->first_name,
'last_name' => $request->last_name,
'sex'=>$request->sex,
'birthdate'=>$request->birthdate,
'email' => $request->email,
'password' => Hash::make($request->password),
]);
event(new Registered($user));
Auth::login($user);
return redirect(RouteServiceProvider::HOME);
}
I tried search for similar issues
2
Answers
Change the following
to
You can add the date_format parameter
‘date_of_birth’ => ‘date_format:Y-m-d’,