From 77f1076c15fbb8bf826a58cb2d556801a82a81ee Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Wed, 26 Dec 2018 09:52:37 -0500 Subject: - Add laravel site directories --- .../Http/Controllers/Auth/RegisterController.php | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 laravel/app/Http/Controllers/Auth/RegisterController.php (limited to 'laravel/app/Http/Controllers/Auth/RegisterController.php') diff --git a/laravel/app/Http/Controllers/Auth/RegisterController.php b/laravel/app/Http/Controllers/Auth/RegisterController.php new file mode 100644 index 0000000..0e8d66a --- /dev/null +++ b/laravel/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:6', '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 1.4.1