Update UserObserver

pull/529/head
Daniel Supernault 2018-10-24 12:20:16 -06:00
rodzic a4d3f55efc
commit b436ac2cbb
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
1 zmienionych plików z 6 dodań i 3 usunięć

Wyświetl plik

@ -6,6 +6,7 @@ use App\Jobs\AvatarPipeline\CreateAvatar;
use App\Profile;
use App\User;
use App\UserSetting;
use DB;
class UserObserver
{
@ -41,9 +42,11 @@ class UserObserver
}
if (empty($user->settings)) {
$settings = new UserSetting();
$settings->user_id = $user->id;
$settings->save();
DB::transaction(function() use($user) {
UserSetting::firstOrCreate([
'user_id' => $user->id
]);
});
}
}
}