The request validate function directly validate the input. If it fails it will throw an exception that is by default handled. (You can catch it and do your own validation)
The return value of the validate function is the data
See: https://laravel.com/docs/8.x/validation#quick-writing-the-validation-logic
public function registerPost(Request $request)
{
$validData = $request->validate([
'rname' => 'required|min:3|max:20|alphaspace',
'rlastname' => 'required|min:3|max:30|alphaspace',
'remail' => 'required|email|unique:users,email',
'password' => 'required|min:8|confirmed',
'password_confirmation' => 'required',
]);
//here can you do something with the validData
//$validData
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community