From 509b0efdcdc32ababaf7d01764037ade69270e84 Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Fri, 12 Feb 2021 21:03:26 +0900 Subject: [PATCH] socialite update --- app/Http/Controllers/Auth/LoginController.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index a9040a506..f5198ba42 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -158,8 +158,10 @@ class LoginController extends Controller * @param \Laravel\Socialite\Two\User $user */ private function createAlt($user, $orgCharacter) { + $altCount = UserAlt::where('character_id', $user->id)->count(); if($altCount == 0) { + //Create the new alt in the table $newAlt = new UserAlt; $newAlt->name = $user->getName(); $newAlt->main_id = $orgCharacter; @@ -170,8 +172,23 @@ class LoginController extends Controller $newAlt->inserted_at = time(); $newAlt->expires_in = $user->expiresIn; $newAlt->save(); + + //Create the entry into the EsiToken table + //Create the entry into the EsiToken table + if(EsiToken::where(['character_id' => $user->id])->count() == 0) { + $this->SaveEsiToken($user); + } else { + $this->UpdateEsiToken($user); + } + + //Create the entry into the EsiScopes table + if(sizeof($user->scopes) > 1) { + $this->SetScopes($user->scopes, $user->id); + } + //Return the successfull conclusion of the function return 1; } else { + //Return the unsuccessfull conclusion of the function return 0; } }