|
|
|
@ -20,7 +20,7 @@ class UserObserver
|
|
|
|
|
public function saved(User $user)
|
|
|
|
|
{
|
|
|
|
|
if (empty($user->profile)) {
|
|
|
|
|
DB::transaction(function() use($user) {
|
|
|
|
|
$profile = DB::transaction(function() use($user) {
|
|
|
|
|
$profile = new Profile();
|
|
|
|
|
$profile->user_id = $user->id;
|
|
|
|
|
$profile->username = $user->username;
|
|
|
|
@ -38,9 +38,16 @@ class UserObserver
|
|
|
|
|
$profile->private_key = $pki_private;
|
|
|
|
|
$profile->public_key = $pki_public;
|
|
|
|
|
$profile->save();
|
|
|
|
|
return $profile;
|
|
|
|
|
});
|
|
|
|
|
DB::transaction(function() use($user, $profile) {
|
|
|
|
|
$user = User::findOrFail($user->id);
|
|
|
|
|
$user->profile_id = $profile->id;
|
|
|
|
|
$user->save();
|
|
|
|
|
|
|
|
|
|
CreateAvatar::dispatch($profile);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (empty($user->settings)) {
|
|
|
|
|