Thanks for your reply!
Unfortunately no email is sent. (At least I haven't received one. Is there a way to check if the email was sent?)
Here is my code
public function registerUser(Request $request){
$data = $request->all();
$validator = Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6'
]);
if ($validator->fails()) {
return response()->json(['error' => $validator->errors()], 401);
}
$user = \App\User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
event( new Registered( $user ) );
$success['message'] = "Registration successfull. Please verify your Email address.";
$success['user'] = $userData = new UserResource( $user );
return response()->json(['success' => $success], $this->successStatus);
}
I also have added the use statement.
Any idea what could be the reason for this not to work?