當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。