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


PHP Team::select方法代码示例

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


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

示例1: storeteamscores

 public function storeteamscores(Request $request)
 {
     $teams = new Team();
     $teamsInfo = $teams->join('fantasy_user_players', 'fantasy_teams.team_id', '=', 'fantasy_user_players.team_id')->join('fantasy_match_scores', 'fantasy_user_players.id', '=', 'fantasy_match_scores.contract_id')->select('fantasy_teams.team_id', 'fantasy_teams.team_name', 'fantasy_teams.team_points', 'fantasy_user_players.match_player', 'fantasy_user_players.id as contract_id', 'fantasy_match_scores.match_id', 'fantasy_match_scores.points')->get();
     $teamPoints = [];
     foreach ($teams->select('team_id', 'team_points as points')->get() as $team) {
         //$teamPoints = array_add($teamPoints, $team->team_id, $team->points);
         $teamPoints[] = ['team_id' => $team->team_id, 'points' => $team->points];
     }
     //team_id, match_id, contract_id, points
     foreach ($teamsInfo as $teamPlayer) {
         $fantasyScores = new FantasyScores();
         if ($teamPlayer->match_player == 1 && !$fantasyScores->where('match_id', $teamPlayer->match_id)->where('contract_id', $teamPlayer->contract_id)->first()) {
             $fantasyScores->team_id = $teamPlayer->team_id;
             $fantasyScores->match_id = $teamPlayer->match_id;
             $fantasyScores->contract_id = $teamPlayer->contract_id;
             $fantasyScores->points = $teamPlayer->points;
             $fantasyScores->save();
             //$teamPoints[$teamPlayer->team_id] += $teamPlayer->points;
             foreach ($teamPoints as $teamPoint => $value) {
                 if ($teamPoints[$teamPoint]['team_id'] == $teamPlayer->team_id) {
                     $teamPoints[$teamPoint]['points'] += $teamPlayer->points;
                 }
             }
         }
     }
     /*foreach ($teamPoints as $teamPoint => $value) {
     			$teamPoints[$teamPoint]['points'] = $teamPoint['points'] + 10;			
     		}*/
     foreach ($teamPoints as $key => $value) {
         DB::table('fantasy_teams')->where('team_id', $teamPoints[$key]['team_id'])->update(['team_points' => $teamPoints[$key]['points']]);
     }
     //$teamPoints = $teams->where('team_id', $teamPoints[$teams->team_id])->get();
     return view('back.scores.index')->with('error', '')->with('qq', $teamPoints);
 }
开发者ID:elvinas21,项目名称:BasketballFantasyLeague,代码行数:35,代码来源:ScoresController.php


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