Update UserObserver

pull/1388/head
Daniel Supernault 2019-06-15 23:30:36 -06:00
rodzic e3c11f76ae
commit 4ee3d10da8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -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)) {