/RegisterController.php Secret
Created
April 9, 2020 11:29
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [...] | |
/** | |
* Create a new user instance after a valid registration. | |
* | |
* @param array $data,. * @return \App\User | |
*/ | |
protected function create(array $data) | |
{ | |
// create the user to Stream Chat | |
$client = new StreamClient( | |
getenv("STREAM_API_KEY"), | |
getenv("STREAM_API_SECRET"), | |
null, | |
null, | |
9 // timeout | |
); | |
$user = [ | |
'id' => preg_replace('/[@\.]/', '_', $data['email']), | |
'name' => $data['name'], | |
'role' => 'admin' | |
]; | |
$client->updateUser($user); | |
return User::create([ | |
'name' => $data['name'], | |
'email' => $data['email'], | |
'password' => Hash::make($data['password']), | |
]); | |
} | |
// [...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment