public function twitterCallbackSignIn() { if ($this->hasCallback()) { $this->verifyTokens(); $reply = $this->client->oauth_accessToken(['oauth_verifier' => $_GET['oauth_verifier']]); if ($reply->httpstatus === 200) { //$this->storeToken($reply->oauth_token, $reply->oauth_token_secret); # Store in databasse $userID = Auth::User(); $clientID = Session::get('clientID'); DB::table('twitterOAuth')->insert(['userID' => $userID->id, 'clientID' => $clientID, 'oauth_token' => $reply->oauth_token, 'oauth_token_secret' => $reply->oauth_token_secret]); //Insert Twitter Name $sm = new SocialMediaVault(); $sm->userID = $userID->id; $sm->clientID = $clientID; $sm->twitterName = $reply->screen_name; $sm->twitterID = $reply->user_id; $sm->save(); $addtw = new SocialTrack(); $addtw->addTwitterToAccount($userID->id); header('Location: /home'); } header('Location: /home'); return ''; } return ''; }
public function deleteSocialMediaAccount($clientID) { $socialMediaToDelete = SocialMediaVault::where('clientID', $clientID)->delete(); echo 'Removed'; }
public function removeSocialAccount() { $clientID = $_POST['clientID']; $removeSocialAccount = new SocialMediaVault(); $removeSocialAccount->deleteSocialMediaAccount($clientID); }