} return Redirect::to(GithubLogin::authorizeUrl()); }); Route::get('/logout', function () { $cookie = GithubLogin::logout(); return Redirect::to('/github/oauth/confirm')->withCookie($cookie); }); Route::get('/github/oauth/callback', function () { if (GithubLogin::check()) { return Redirect::to('/'); } $code = Input::get('code'); if ($code == '') { return 'CODE ERROR'; } $accessToken = \Eleme\Github\GithubAuthorize::accessToken($code); if ($accessToken == NULL) { echo "CODE ERROR"; } $client = new \Eleme\Github\GithubClient($accessToken); $teams = $client->request('user/teams'); $haveEleme = false; $orgTeams = array(); foreach ($teams as $team) { if ($team->organization->login == Config::get('github.organization')) { $haveEleme = true; $orgTeams[] = $gt = new GithubTeam($team); TeamRepos::delByTeamId($gt->id); } } if ($haveEleme) {
public static function authorizeUrl() { return GithubAuthorize::authorizeUrl(Config::get('github.scope')); }