Update AuthLogin listener

This commit is contained in:
Daniel Supernault 2020-11-25 10:10:16 -07:00
parent 362fd1b029
commit 8e8e6cafec
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 7 additions and 0 deletions

View File

@ -42,6 +42,13 @@ class AuthLogin
protected function userProfile($user)
{
if (empty($user->profile)) {
if($user->created_at->lt(now()->subDays(1))) {
$p = Profile::withTrashed()->whereUserId($user->id)->first();
if($p) {
$p->restore();
return;
}
}
DB::transaction(function() use($user) {
$profile = Profile::firstOrCreate(['user_id' => $user->id]);
if($profile->wasRecentlyCreated == true) {