diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 16e8db1..a2afbd5 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -54,6 +54,7 @@ protected function validator(array $data) 'grad_year' => ['required', 'integer'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'password' => ['required', 'string', 'min:8', 'confirmed'], + 'role' => 'required' ]); } @@ -65,11 +66,15 @@ protected function validator(array $data) */ protected function create(array $data) { - return User::create([ + $user = User::create([ 'name' => $data['name'], 'grad_year' => $data['grad_year'], 'email' => $data['email'], 'password' => Hash::make($data['password']), ]); + + $user->assignRole($data['role']); + + return $user; } }