public function deploy($siteId)
 {
     $pr = new PullRequest($siteId);
     $commits = $pr->getList();
     $commitList = array();
     foreach ($commits as $m) {
         if ($m->testStatus == 'Success' && $m->status == 'open') {
             $commitList[] = array('title' => $m->title, 'commit' => $m->commit);
         }
     }
     $ht = new HostType();
     $hostTypes = $ht->getList();
     $hostList = array();
     foreach ($hostTypes as $hostType) {
         $hostList = array_merge($hostList, (new SiteHost($siteId, $hostType, SiteHost::STATIC_HOST))->getList());
         $hostList = array_merge($hostList, (new SiteHost($siteId, $hostType, SiteHost::WEB_HOST))->getList());
     }
     $existHostTypes = array();
     $user = GithubLogin::getLoginUser();
     $hp = (new HostType())->permissionList();
     $deployPermissions = array();
     foreach ($_ENV as $key => $value) {
         if (strpos($key, 'DEPLOY_PERMISSIONS') === 0) {
             $deployPermissions[substr($key, strlen('DEPLOY_PERMISSIONS') + 1)] = $value;
         }
     }
     $userTeams = array();
     foreach ($user->teams as $team) {
         $userTeams[] = $team->name;
     }
     foreach ($hostList as $host) {
         //Debugbar::info($user->permissions[$siteId] . ' ' . $hp[$host['hosttype']]);
         $canDeploy = true;
         if (!empty($deployPermissions[$host['hosttype']])) {
             $teamName = $deployPermissions[$host['hosttype']];
             if (!in_array($teamName, $userTeams)) {
                 $canDeploy = false;
             }
         }
         if ($canDeploy && !empty($user->permissions[$siteId]) && $hp[$host['hosttype']] == 'pull' && DeployPermissions::havePermission($hp[$host['hosttype']], $user->permissions[$siteId])) {
             $existHostTypes[$host['hosttype']] = $host['hosttype'];
         }
     }
     $pr = new PullRequest($siteId);
     $list = $pr->getList();
     $prList = array();
     foreach ($list as &$m) {
         $prList[$m->commit] = array('url' => $m->url, 'repo' => $m->repo, 'branch' => $m->branch);
     }
     $prd = new PullRequestDeploy($siteId);
     $prdList = $prd->getList();
     return View::make('pullrequest.deploy', array('siteId' => $siteId, 'leftNavActive' => 'pullRequestDeploy', 'commitList' => $commitList, 'hostTypeList' => $existHostTypes, 'toDeploy' => Input::get('toDeploy'), 'prdList' => $prdList, 'prList' => $prList));
 }