forked from mirror/pixelfed
Update UserObserver
This commit is contained in:
parent
a4d3f55efc
commit
b436ac2cbb
1 changed files with 6 additions and 3 deletions
|
@ -6,6 +6,7 @@ use App\Jobs\AvatarPipeline\CreateAvatar;
|
||||||
use App\Profile;
|
use App\Profile;
|
||||||
use App\User;
|
use App\User;
|
||||||
use App\UserSetting;
|
use App\UserSetting;
|
||||||
|
use DB;
|
||||||
|
|
||||||
class UserObserver
|
class UserObserver
|
||||||
{
|
{
|
||||||
|
@ -41,9 +42,11 @@ class UserObserver
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($user->settings)) {
|
if (empty($user->settings)) {
|
||||||
$settings = new UserSetting();
|
DB::transaction(function() use($user) {
|
||||||
$settings->user_id = $user->id;
|
UserSetting::firstOrCreate([
|
||||||
$settings->save();
|
'user_id' => $user->id
|
||||||
|
]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue