From fb0c574ed1725fe13c8ab073d2ead3fdc842c2ba Mon Sep 17 00:00:00 2001 From: Phil Burton Date: Fri, 1 Nov 2019 22:56:27 +0000 Subject: Added laravel project --- app/Http/Controllers/Auth/RegisterController.php | 72 ++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 app/Http/Controllers/Auth/RegisterController.php (limited to 'app/Http/Controllers/Auth/RegisterController.php') diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php new file mode 100644 index 0000000..6fdcba0 --- /dev/null +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -0,0 +1,72 @@ +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' => ['required', 'string', 'max:255'], + 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], + 'password' => ['required', 'string', 'min:8', 'confirmed'], + ]); + } + + /** + * Create a new user instance after a valid registration. + * + * @param array $data + * @return \App\User + */ + protected function create(array $data) + { + return User::create([ + 'name' => $data['name'], + 'email' => $data['email'], + 'password' => Hash::make($data['password']), + ]); + } +} -- cgit v1.2.3