From 92eb8143762e116e8959f6270271fd5540ca50ac Mon Sep 17 00:00:00 2001 From: horus_arch Date: Wed, 7 Feb 2018 18:07:53 +0100 Subject: Adds basic site in laravel. --- .../Http/Controllers/Auth/RegisterController.php | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 site/app/Http/Controllers/Auth/RegisterController.php (limited to 'site/app/Http/Controllers/Auth/RegisterController.php') diff --git a/site/app/Http/Controllers/Auth/RegisterController.php b/site/app/Http/Controllers/Auth/RegisterController.php new file mode 100644 index 0000000..f77265a --- /dev/null +++ b/site/app/Http/Controllers/Auth/RegisterController.php @@ -0,0 +1,71 @@ +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' => bcrypt($data['password']), + ]); + } +} -- cgit v1.2.3