Skip to content

Instantly share code, notes, and snippets.

@BrightnBubbly
Created April 9, 2020 11:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save BrightnBubbly/68ce936461b4e30732c0a162fcfa123d to your computer and use it in GitHub Desktop.
// [...]
/**
* 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