예제 #1
0
 /**
  * @param string $backUrl
  * @param int $player_id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function add($backUrl = 'entree', $player_id = 0)
 {
     if ($player_id == 0) {
         return Redirect::route($backUrl);
     }
     $player = Player::find($player_id);
     // Cree Entree
     $entree = new Entree();
     $entree->compet_id = MySession::getModel('compet')->id;
     $entree->statusentree_id = 1;
     $entree->teamname = "";
     $entree->hcp = 0;
     $entree->save();
     // Cree les EntreePlayers (en fonction du Compet->TypeCompet->nbplayers
     $nbPlayers = MySession::getModel('compet')->typecompet->nbplayers;
     for ($pl = 1; $pl <= $nbPlayers; $pl++) {
         $entreePlayer = new Entreeplayer();
         $entreePlayer->entree_id = $entree->id;
         if ($pl == 1) {
             $entreePlayer->player_id = $player->id;
             $entreePlayer->hcp = $player->hcp;
         }
         $entreePlayer->num = $pl;
         $entreePlayer->save();
         // get Categorie
         if ($pl == 1) {
             $entreePlayer->competcategorie_id = $entreePlayer->getCategorie();
             $entreePlayer->save();
         }
     }
     return Redirect::route($backUrl);
 }
예제 #2
0
 public function skipDoDelete($backUrl = 'entree', $id)
 {
     $entreePlayer = Entreeplayer::find($id);
     $entreePlayer->player_id = 0;
     $entreePlayer->hcp = 0;
     $entreePlayer->competcategorie_id = 0;
     $entreePlayer->save();
     return Redirect::route($backUrl);
 }
예제 #3
0
파일: Entree.php 프로젝트: birdiebel/G2016
 public function getListPlayerId()
 {
     // Liste des Joueurs deja inscrit dans ces EntreePlayer (donc la compétition en cours)
     return Entreeplayer::whereEntreeId($this->id)->lists('player_id');
 }