Skip to content

Commit

Permalink
Update RegisterController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
flxcn committed Jul 29, 2022
1 parent 568a1e8 commit 27c9efa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]);
}

Expand All @@ -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;
}
}

0 comments on commit 27c9efa

Please sign in to comment.