当前位置: 首页>>代码示例>>PHP>>正文


PHP Team::save方法代码示例

本文整理汇总了PHP中Team::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::save方法的具体用法?PHP Team::save怎么用?PHP Team::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Team的用法示例。


在下文中一共展示了Team::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
 * Store a newly created resource in storage.
 * POST /team
 *
 * @return Response
 */
 public function store()
 {
     //get current club
     $user = Auth::user();
     $club = $user->Clubs()->FirstOrFail();
     $uuid = Uuid::generate();
     $validator = Validator::make(Input::all(), Team::$rules);
     if ($validator->passes()) {
         $team = new Team();
         $team->id = $uuid;
         $team->name = Input::get('name');
         $team->season_id = Input::get('season_id');
         $team->program_id = Input::get('program_id');
         $team->description = Input::get('description');
         $team->early_due = Input::get('early_due');
         $team->early_due_deadline = Input::get('early_due_deadline');
         $team->due = Input::get('due');
         $team->plan_id = Input::get('plan_id');
         $team->open = Input::get('open');
         $team->close = Input::get('close');
         $team->max = Input::get('max');
         $team->status = Input::get('status');
         $team->club_id = $club->id;
         $team->allow_plan = 1;
         $status = $team->save();
         if ($status) {
             return Redirect::action('TeamController@index')->with('messages', 'Program created successfully');
         } else {
             $error = $status->errors()->all(':message');
             return Redirect::back()->withInput()->withErrors($error);
         }
     }
     $error = $validator->errors()->all(':message');
     return Redirect::back()->withErrors($error)->withInput();
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:41,代码来源:TeamController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  * POST /group
  *
  * @return Response
  */
 public function store($id)
 {
     //create sub team
     //return Redirect::action('SubController@create',$id)->with( 'notice', 'This action cannot be perform at this moment, please comeback soon.');
     $user = Auth::user();
     $club = $user->clubs()->FirstOrFail();
     $parent_team = Team::find($id);
     $uuid = Uuid::generate();
     $validator = Validator::make(Input::all(), Team::$rules_group);
     if ($validator->passes()) {
         $team = new Team();
         $team->id = $uuid;
         $team->name = Input::get('name');
         $team->season_id = $parent_team->season_id;
         $team->program_id = $parent_team->program_id;
         $team->description = $parent_team->description;
         $team->early_due = $parent_team->getOriginal('early_due');
         $team->early_due_deadline = $parent_team->early_due_deadline;
         $team->due = $parent_team->getOriginal('due');
         $team->plan_id = $parent_team->plan_id;
         $team->open = $parent_team->open;
         $team->close = $parent_team->close;
         $team->max = Input::get('max');
         $team->status = $parent_team->getOriginal('status');
         $team->parent_id = $parent_team->id;
         $team->club_id = $club->id;
         $team->allow_plan = 1;
         $status = $team->save();
         if ($status) {
             return Redirect::action('TeamController@show', $parent_team->id)->with('messages', 'Group created successfully');
         }
     }
     $error = $validator->errors()->all(':message');
     return Redirect::action('SubController@create', $id)->withErrors($validator)->withInput();
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:41,代码来源:SubController.php

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Team();
     $model->attributes = $_POST;
     $result = $model->save();
     $this->sendAjaxResponse($model);
 }
开发者ID:pdooley,项目名称:genesis,代码行数:11,代码来源:TeamController.php

示例4: createByName

 public function createByName($name)
 {
     print_r('[' . $name . ']');
     $document = new Team();
     $document->setName($name);
     $document->setSlug();
     $document->save();
     $document = $this->findOneBySlug($document->getSlug());
     return $document;
 }
开发者ID:bigjoevtrj,项目名称:codeigniter-bootstrap,代码行数:10,代码来源:levelrepository.php

示例5: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Team();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Team'])) {
         $model->attributes = $_POST['Team'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:rooxy,项目名称:feedback,代码行数:17,代码来源:TeamController.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(create_team_request $request)
 {
     //
     $newName = md5($request->file('image')) . $request->file('image')->getClientOriginalName();
     $path = 'teams';
     $request->file('image')->move($path, $newName);
     $teamDb = new Team();
     $teamDb->name = $request->input('name');
     $teamDb->content = $request->input('content');
     $teamDb->image = $newName;
     $teamDb->save();
     return redirect('team');
 }
开发者ID:alaaelgndy,项目名称:eduAppSite,代码行数:19,代码来源:teamController.php

示例7: getOrCreateTeam

 protected function getOrCreateTeam($name, $nickname)
 {
     $nickname = trim($nickname);
     $name = trim(str_replace($nickname, '', $name));
     $slug = $this->CI->slugify->simple($name);
     $team = $this->CI->_team->findOneBySlug($slug);
     if (!$team) {
         $team = new Team();
         $team->setName($name);
         $team->setNickname($nickname);
         $team->save();
     }
     return $team;
 }
开发者ID:bigjoevtrj,项目名称:codeigniter-bootstrap,代码行数:14,代码来源:PointstreakParse.php

示例8: store

 public static function store()
 {
     $params = $_POST;
     $Team = new Team(array('name' => $params['name'], 'year' => $params['year'], 'city' => $params['city']));
     $errors = $Team->errors();
     if (count($errors) != 0) {
         View::make('/Team/new.html', array('errors' => $errors, 'team' => $Team));
     } else {
         $Team->save();
         $player = self::get_user_logged_in();
         $m = new Teammember(array('player_id' => $player->id, 'team_id' => $Team->id));
         $m->save();
         Redirect::to('/team/' . $Team->id, array('message' => 'Joukkue luotu!'));
     }
 }
开发者ID:Jonharju,项目名称:Tsoha-Bootstrap,代码行数:15,代码来源:team_controller.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rules = ['teamname' => 'required'];
     //validation
     $validation = Validator::make(Input::all(), $rules);
     if ($validation->passes()) {
         $team = new Team();
         $team->teamname = Input::get('teamname');
         $team->save();
         // redirect
         Session::flash('message', 'Successfully created team Owners!');
         return Redirect::to('view');
         //return View::make('pages.register')->with('message', 'team created');
     }
     return Redirect::back()->withErrors($validation)->withInput();
 }
开发者ID:Homeboyzandroid,项目名称:greensport,代码行数:21,代码来源:TeamController.php

示例10: newteam

 function newteam($data)
 {
     if ($data['name'] && $data['email'] && $data['country_id'] && $data['submiter']) {
         $newteam = new Team();
         $newteam->name = sqlite_escape_string($data['name']);
         $newteam->description = sqlite_escape_string($data['description']);
         $newteam->email = sqlite_escape_string($data['email']);
         $newteam->homepage = sqlite_escape_string($data['homepage']);
         $newteam->mailinglist = sqlite_escape_string($data['mailinglist']);
         $newteam->irc = sqlite_escape_string($data['irc']);
         $newteam->location = sqlite_escape_string($data['location']);
         $newteam->country_id = sqlite_escape_string($data['country_id']);
         $newteam->submiter = sqlite_escape_string($data['submiter']);
         $newteam->save();
         return true;
     } else {
         return false;
     }
 }
开发者ID:stas,项目名称:bebuntu,代码行数:19,代码来源:teams-controller.php

示例11: postCreate

 /**
  * Creates our section when POSTed to. Performs snazzy validation.
  * @return [type] [description]
  */
 public function postCreate()
 {
     $rules = array('name' => 'required|max:255|unique:teams', 'tag' => 'required|max:255', 'upload-logo' => 'max:2500');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::action('Admin_TeamsController@getCreate')->withInput()->withErrors($validator);
     } else {
         $team = new Team();
         $team->name = Input::get('name');
         $team->tag = Input::get('tag');
         if (Input::hasFile('upload-logo')) {
             $logofile = Input::file('upload-logo');
             $logofileext = $logofile->getClientOriginalExtension();
             $logo_name = "Team_" . Str::limit(md5(Input::get('name')), 10, false) . '-' . Str::limit(md5(time()), 10, false) . "_" . Str::slug(Input::get('name')) . "." . $logofileext;
             $logofile->move($this->dir, $logo_name);
             $team->logo = $logo_name;
         }
         $team->save();
         return Redirect::action('Admin_TeamsController@getIndex');
     }
 }
开发者ID:TsunamiNori,项目名称:Raffles,代码行数:25,代码来源:TeamsController.php

示例12: load

 public function load()
 {
     $this->clear();
     // Miami Hurricanes
     $team = new Team('Miami, FL');
     $team->setOfficialName('University of Miami');
     $team->setNickname('Hurricanes');
     $team->setCity('Miami');
     $team->setState('FL');
     $team->setNcaaId(415);
     $level = $this->CI->_level->findOneBySlug('college');
     $team->setLevel($level);
     $league = $this->CI->_league->findOneBySlug('ncaa');
     $team->setLeague($league);
     $division = $this->CI->_division->findOneBySlug('d1');
     $team->setDivision($division);
     $conference = $this->CI->_conference->findOneBySlug('atlantic-coast');
     $team->setConference($conference);
     $team->save();
     print_r(sprintf("Created Team: %s (%s)\n", $team->getName(), $team->getId()));
     // Maryland Terrapins
     $team = new Team('Maryland');
     $team->setOfficialName('University of Maryland');
     $team->setNickname('Terrapins');
     $team->setCity('College Park');
     $team->setState('FL');
     $team->setNcaaId(392);
     $level = $this->CI->_level->findOneBySlug('college');
     $team->setLevel($level);
     $league = $this->CI->_league->findOneBySlug('ncaa');
     $team->setLeague($league);
     $division = $this->CI->_division->findOneBySlug('d1');
     $team->setDivision($division);
     $conference = $this->CI->_conference->findOneBySlug('atlantic-coast');
     $team->setConference($conference);
     $team->save();
     print_r(sprintf("Created Team: %s (%s)\n", $team->getName(), $team->getId()));
 }
开发者ID:bigjoevtrj,项目名称:codeigniter-bootstrap,代码行数:38,代码来源:team.php

示例13: updateTeams

 public function updateTeams()
 {
     $aPoules = Poule::getAll(array('season_nefub_id' => Season::getInstance()->nefub_id), 'competition_nefub_id');
     foreach ($aPoules as $oPoule) {
         $aPouleTeams = $oPoule->getPouleTeams();
         foreach ($aPouleTeams as $oPouleTeam) {
             $team = $this->getAPITeamDetails($oPouleTeam->team_nefub_id);
             $oTeam = Team::getByNefubId($team->ID);
             if (!$oTeam) {
                 $oTeam = new Team();
                 $oTeam->nefub_id = $team->ID;
                 $oTeam->name = $team->Name;
                 $oTeam->competition_nefub_id = $oPoule->competition_nefub_id;
                 $oTeam->season_nefub_id = $oPoule->getCompetition()->season_nefub_id;
                 $oTeam->club_nefub_id = $team->Club->ID;
                 $oTeam->color_shirt = $team->Dress->Shirt;
                 $oTeam->color_shorts = $team->Dress->Short;
                 self::put('Team ' . $team->Name . ' toegevoegd');
                 $oTeam->save();
             }
             if (isset($team->Players) && is_array($team->Players)) {
                 foreach ($team->Players as $teamPlayer) {
                     $this->convertTeamPerson($teamPlayer, $oTeam);
                 }
             } else {
                 self::put('Geen spelers gevonden voor ' . $team->Name);
             }
             $this->retrieveClub($team->Club);
             $this->retrieveTeamGames($team, 'schedule');
             $query = "SELECT COUNT(Game.nefub_id) as countGames\n\t\t\t\t\t\t\tFROM Game\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t(team1_nefub_id = '" . $team->ID . "'\n\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\tteam2_nefub_id = '" . $team->ID . "')\n\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\tGame.date <= CURDATE()";
             $rows = Database::select_rows_by_query($query);
             $playedGames = $rows[0]['countGames'];
             $bRetrieveResults = false;
             if ($playedGames) {
                 // Als er geen oude wedstrijden in de DB staan, vermoedelijk zijn ze dan niet eerder opgehaald.
                 $query .= " AND Game.actions_retrieved = 0";
                 $rows = Database::select_rows_by_query($query);
                 $gamesToRetrieve = $rows[0]['countGames'];
                 $bRetrieveResults = $gamesToRetrieve != 0;
             }
             if ($bRetrieveResults) {
                 $this->retrieveTeamGames($team, 'results');
             } else {
                 self::put('Resultaten voor ' . $oTeam->name . ' hoeven niet vernieuwd te worden');
             }
             $oTeam->save();
             $this->retrievedTeamNefubIds[$oPouleTeam->team_nefub_id] = true;
         }
     }
 }
开发者ID:rjpijpker,项目名称:nefub-mobile,代码行数:50,代码来源:MapperRetriever.php

示例14: actionTeams

 public function actionTeams($id)
 {
     $model = $this->loadModel($id);
     $players = $model->players;
     if (isset($_POST['Teams']['info'])) {
         $error = false;
         $data = CJSON::decode($_POST['Teams']['info']);
         foreach ($data['players'] as $key => $player) {
             $_player = PlayerTournament::model()->findByPk($player['id']);
             $_player->chip_pulled = $player['chip_pulled'];
             if (!$_player->save()) {
                 $error = true;
             }
             $team = new Team();
             $team->tournament_id = $id;
             $team->player_id = $player['player_id'];
             $team->position = $player['chip_pulled'];
             if (!$team->save()) {
                 $error = true;
             }
         }
         $teams = $model->get_teams();
         //echo "<pre>";print_r($teams);echo "</pre>";exit;
         $max_teams = Team::model()->findAllByAttributes(array('tournament_id' => $model->id), array('order' => 'position DESC'));
         $c = new ChallongeAPI(Yii::app()->params['challonge_api']);
         foreach (range(1, $max_teams[0]->position) as $position) {
             $params = array("participant[name]" => $model->get_team_name($position), "participant[seed]" => $position);
             $participant = $c->createParticipant($model->challonge_id, $params)->participant;
             if ($participant) {
                 Team::model()->updateAll(array('challonge_participant_id' => $participant->id), "tournament_id = {$model->id} and position = {$position}");
             }
         }
         if (!$error) {
             Yii::app()->user->setFlash('success', 'Teams saved.');
             $this->redirect(array('teams', 'id' => $id));
         }
         $message = "";
         foreach ($_player->getErrors() as $error) {
             $message .= $error . "<br />";
         }
         Yii::app()->user->setFlash('error', $message);
     }
     $this->render('teams', array('model' => $model, 'players' => $players, 'registered_players' => $model->registered_players(), 'teams' => $model->get_teams()));
 }
开发者ID:cfletcher1856,项目名称:austinblinddraw,代码行数:44,代码来源:TournamentController.php

示例15: createteam

 public function createteam($aData)
 {
     if ($this->samePlayer($aData['teammate1_id'], $aData['teammate2_id'])) {
         throw new Exception('Musisz wybrać dwóch różnych zawodników!');
     }
     if ($this->checkIfTeamExists($aData['Tournaments_id'], $aData['teammate1_id'], $aData['teammate2_id'])) {
         throw new Exception('Nie można dodać takiej drużyny do tego turnieju!');
     }
     $tour = $this->getTable()->find($aData['Tournaments_id']);
     $player1 = Player::getPlayerById($aData['teammate1_id']);
     $player2 = Player::getPlayerById($aData['teammate2_id']);
     if (!$this->checkTournament($player1->gender, $player2->gender, $tour->kind)) {
         throw new Exception('Rodzaj turnieju nie pozwala na zestawienie takiego zespołu. Wybierz do turnieju męskiego dwie pary męskie, do żeńskiego dwie pary kobiece, a do mieszanego parę mieszaną.');
     }
     $team = new Team();
     $team->Tournaments_id = (int) $aData['Tournaments_id'];
     $team->teammate1_id = (int) $aData['teammate1_id'];
     $team->teammate2_id = (int) $aData['teammate2_id'];
     $team->enrolled = new Doctrine_Expression('NOW()');
     $team->save();
     $countTeams = $tour->Teams->count();
     if ($countTeams) {
         $countTeams *= 10;
         $tour->rank = $countTeams;
         $tour->save();
     }
 }
开发者ID:jager,项目名称:cms,代码行数:27,代码来源:Tournament.php


注:本文中的Team::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。