middleware('guest'); } /** * Get a validator for an incoming registration request. * * @param array $data * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) { return Validator::make($data, [ 'name' => [ 'regex:/^[a-zA-Z0-9_.-]+$/', 'required', 'string', 'max:255', 'unique:users' ], 'email' => 'required|string|email|max:255|unique:users', 'password' => 'required|string|min:6|max:1000|confirmed', // max len to foil DOS attempts ]); } /** * Create a new user instance after a valid registration. * * @param array $data * @return \App\Models\User */ protected function create(array $data) { return User::create([ 'name' => $data['name'], 'title' => $data['name'], 'email' => $data['email'], 'password' => Hash::make($data['password']), ]); } }