コード例 #1
0
 /**
  * Display the home page.
  *
  * @return Response
  */
 public function index()
 {
     $teamResults = Team::orderBy('team_points', 'desc')->take(10)->get();
     $matchDb = new Match();
     $match = $matchDb->join('fantasy_club as home', 'fantasy_match.home_club_id', '=', 'home.club_id')->join('fantasy_club as guest', 'fantasy_match.guest_club_id', '=', 'guest.club_id')->select('home.club_name as home_name', 'guest.club_name as guest_name', 'match_date')->get();
     return view('front.index')->with('teamResults', $teamResults)->with('j', $j = 1)->with('matches', $match);
 }
コード例 #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $author = new User();
     $authors = $author->all();
     $match = new Match();
     $matches = $match->all();
     return view('commentary.index')->with('authors', $authors)->with('matches', $matches);
 }
コード例 #3
0
 public function save($data1, $data2, $data3, $data4, $data5, $data6)
 {
     $match = new Match();
     $match->team_1 = $data1;
     $match->score_team_1 = $data2;
     $match->team_2 = $data3;
     $match->score_team_2 = $data4;
     $match->date = $data5;
     $match->id_calendar = $data6;
     $match->save();
 }
コード例 #4
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Request $request, Vote $votes)
 {
     $player1ID = Input::get('ddlPlayer1');
     $player2ID = Input::get('ddlPlayer2');
     $players_list = Player::orderby('last_name')->orderby('first_name')->get()->lists('last_first_name', 'player_id');
     $player1 = Player::where('player_id', '=', $player1ID)->first();
     $player2 = Player::where('player_id', '=', $player2ID)->first();
     $h2h = new Match();
     $head2head = $h2h->head2head($player1ID, $player2ID);
     $skills = Skill::orderby('skill_id')->get();
     $voter_id = \Auth::user()->id;
     return view('pages/matchups.show', compact('players_list', 'player1', 'player2', 'head2head', 'skills', 'votes', 'voter_id'));
 }
コード例 #5
0
ファイル: WonSet.php プロジェクト: stefanledin/mmpingis
 /**
  * Handle the event.
  *
  * @param  PlayerWonSet  $event
  * @return void
  */
 public function handle(PlayerWonSet $event)
 {
     $match = Match::find($event->player->match->id);
     $player = Player::find($event->player->id);
     $player->sets_won += 1;
     $player->save();
 }
コード例 #6
0
 /**
  * Fills matches table
  *
  */
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Match::create([]);
     }
 }
コード例 #7
0
ファイル: TestApi.php プロジェクト: stefanledin/mmpingis
 function test_new_set()
 {
     $this->dummyData();
     $response = $this->call('GET', '/match/startnewset');
     $this->assertEquals(200, $response->status());
     $this->assertEquals(2, Match::find($this->match->id)->currentSet());
 }
コード例 #8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $matches = [1 => ['id' => 1, 'date' => \Carbon\Carbon::create(2016, 6, 10, 21, 0, 0), 'stadium' => 'Stade de France', 'teams' => [7, 16]], 2 => ['id' => 2, 'date' => \Carbon\Carbon::create(2016, 6, 11, 15, 0, 0), 'stadium' => 'Felix', 'teams' => [1, 21]], 3 => ['id' => 3, 'date' => \Carbon\Carbon::create(2016, 6, 15, 18, 0, 0), 'stadium' => 'Matmut', 'teams' => [16, 21]], 4 => ['id' => 4, 'date' => \Carbon\Carbon::create(2016, 6, 15, 21, 0, 0), 'stadium' => 'Stade de France', 'teams' => [7, 1]], 5 => ['id' => 5, 'date' => \Carbon\Carbon::create(2016, 6, 19, 21, 0, 0), 'stadium' => 'Felix', 'teams' => [16, 1]], 6 => ['id' => 6, 'date' => \Carbon\Carbon::create(2016, 6, 19, 21, 0, 0), 'stadium' => 'Matmut', 'teams' => [21, 7]], 7 => ['id' => 7, 'date' => \Carbon\Carbon::create(2016, 6, 11, 18, 0, 0), 'stadium' => 'Stade de France', 'teams' => [24, 18]], 8 => ['id' => 8, 'date' => \Carbon\Carbon::create(2016, 6, 11, 21, 0, 0), 'stadium' => 'Felix', 'teams' => [6, 17]], 9 => ['id' => 9, 'date' => \Carbon\Carbon::create(2016, 6, 15, 15, 0, 0), 'stadium' => 'Matmut', 'teams' => [17, 18]], 10 => ['id' => 10, 'date' => \Carbon\Carbon::create(2016, 6, 16, 15, 0, 0), 'stadium' => 'Stade de France', 'teams' => [6, 24]], 11 => ['id' => 11, 'date' => \Carbon\Carbon::create(2016, 6, 20, 21, 0, 0), 'stadium' => 'Stade de France', 'teams' => [17, 24]], 12 => ['id' => 12, 'date' => \Carbon\Carbon::create(2016, 6, 20, 21, 0, 0), 'stadium' => 'Felix', 'teams' => [18, 6]], 13 => ['id' => 13, 'date' => \Carbon\Carbon::create(2016, 6, 12, 15, 0, 0), 'stadium' => 'Matmut', 'teams' => [23, 13]], 14 => ['id' => 14, 'date' => \Carbon\Carbon::create(2016, 6, 12, 18, 0, 0), 'stadium' => 'Stade de France', 'teams' => [8, 14]], 15 => ['id' => 15, 'date' => \Carbon\Carbon::create(2016, 6, 16, 18, 0, 0), 'stadium' => 'Felix', 'teams' => [14, 13]], 16 => ['id' => 16, 'date' => \Carbon\Carbon::create(2016, 6, 16, 21, 0, 0), 'stadium' => 'Matmut', 'teams' => [8, 23]], 17 => ['id' => 17, 'date' => \Carbon\Carbon::create(2016, 6, 21, 18, 0, 0), 'stadium' => 'Stade de France', 'teams' => [14, 23]], 18 => ['id' => 18, 'date' => \Carbon\Carbon::create(2016, 6, 21, 18, 0, 0), 'stadium' => 'Felix', 'teams' => [13, 8]], 19 => ['id' => 19, 'date' => \Carbon\Carbon::create(2016, 6, 12, 15, 0, 0), 'stadium' => 'Matmut', 'teams' => [22, 4]], 20 => ['id' => 20, 'date' => \Carbon\Carbon::create(2016, 6, 13, 15, 0, 0), 'stadium' => 'Stade de France', 'teams' => [19, 5]], 21 => ['id' => 21, 'date' => \Carbon\Carbon::create(2016, 6, 17, 18, 0, 0), 'stadium' => 'Stade de France', 'teams' => [5, 4]], 22 => ['id' => 22, 'date' => \Carbon\Carbon::create(2016, 6, 17, 21, 0, 0), 'stadium' => 'Felix', 'teams' => [19, 22]], 23 => ['id' => 23, 'date' => \Carbon\Carbon::create(2016, 6, 21, 21, 0, 0), 'stadium' => 'Matmut', 'teams' => [5, 22]], 24 => ['id' => 24, 'date' => \Carbon\Carbon::create(2016, 6, 21, 21, 0, 0), 'stadium' => 'Stade de France', 'teams' => [4, 19]], 25 => ['id' => 25, 'date' => \Carbon\Carbon::create(2016, 6, 13, 18, 0, 0), 'stadium' => 'Felix', 'teams' => [11, 20]], 26 => ['id' => 26, 'date' => \Carbon\Carbon::create(2016, 6, 13, 21, 0, 0), 'stadium' => 'Matmut', 'teams' => [3, 12]], 27 => ['id' => 27, 'date' => \Carbon\Carbon::create(2016, 6, 17, 15, 0, 0), 'stadium' => 'Stade de France', 'teams' => [12, 20]], 28 => ['id' => 28, 'date' => \Carbon\Carbon::create(2016, 6, 18, 15, 0, 0), 'stadium' => 'Felix', 'teams' => [3, 11]], 29 => ['id' => 29, 'date' => \Carbon\Carbon::create(2016, 6, 22, 21, 0, 0), 'stadium' => 'Matmut', 'teams' => [12, 11]], 30 => ['id' => 30, 'date' => \Carbon\Carbon::create(2016, 6, 22, 21, 0, 0), 'stadium' => 'Stade de France', 'teams' => [20, 3]], 31 => ['id' => 31, 'date' => \Carbon\Carbon::create(2016, 6, 14, 18, 0, 0), 'stadium' => 'Stade de France', 'teams' => [2, 9]], 32 => ['id' => 32, 'date' => \Carbon\Carbon::create(2016, 6, 14, 21, 0, 0), 'stadium' => 'Felix', 'teams' => [15, 10]], 33 => ['id' => 33, 'date' => \Carbon\Carbon::create(2016, 6, 18, 18, 0, 0), 'stadium' => 'Matmut', 'teams' => [10, 9]], 34 => ['id' => 34, 'date' => \Carbon\Carbon::create(2016, 6, 18, 21, 0, 0), 'stadium' => 'Stade de France', 'teams' => [15, 2]], 35 => ['id' => 35, 'date' => \Carbon\Carbon::create(2016, 6, 22, 21, 0, 0), 'stadium' => 'Felix', 'teams' => [10, 2]], 36 => ['id' => 36, 'date' => \Carbon\Carbon::create(2016, 6, 22, 21, 0, 0), 'stadium' => 'Matmut', 'teams' => [9, 15]]];
     foreach ($matches as $match) {
         $m = \App\Match::create(['date' => $match['date'], 'stadium' => $match['stadium']]);
         $m->teams()->attach($match['teams'][0]);
         $m->teams()->attach($match['teams'][1]);
     }
 }
コード例 #9
0
 public function test_player1_wins_match()
 {
     $player1 = new Player(['points' => 10, 'sets_won' => 1]);
     $player2 = new Player(['points' => 9, 'sets_won' => 1]);
     $match = Match::create();
     $match->players()->saveMany([$player1, $player2]);
     $match->addPointFor($player1);
     $this->assertEquals($player1->id, Match::find($match->id)->won_by);
     $this->assertEquals(2, Player::find($player1->id)->sets_won);
 }
コード例 #10
0
 function test_starts_new_set()
 {
     $player = new Player(['nickname' => 'Stefan', 'points' => 10]);
     $opponent = new Player(['nickname' => 'Fredrik', 'points' => 9]);
     $match = Match::create();
     $match->players()->saveMany([$player, $opponent]);
     Event::fire(new App\Events\PlayerScoredPoint($player, true));
     $this->assertEquals(11, $player->points);
     $this->assertEquals(9, $opponent->points);
 }
コード例 #11
0
 function test_it_works()
 {
     $player = new Player(['nickname' => 'Stefan', 'points' => 10]);
     $opponent = new Player(['nickname' => 'Fredrik', 'points' => 9]);
     $match = Match::create(['set' => 2]);
     $match->players()->saveMany([$player, $opponent]);
     Event::fire(new App\Events\PlayerWonSet($player));
     $this->assertEquals(2, Match::find($match->id)->currentSet());
     $this->assertEquals(1, Player::find($player->id)->sets_won);
 }
コード例 #12
0
 /**
  * Delete all matches action(reboot ladder).
  *
  * @param  Request  $request
  * @return Response
  */
 public function deleteMatches(Request $request)
 {
     if (!$request->user()->admin) {
         abort(403);
     }
     foreach (Match::all() as $match) {
         $match->delete();
     }
     return view('match.partials.table')->with('matches', Match::all());
 }
コード例 #13
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     // This method finds the player by id. so the url would be players/1
     // If an id of 1 doesn't exist laravel will throw an exception
     $team = Team::findOrFail($id);
     $matches = Match::table('matches')->get();
     // This passes the data to the view. The compact function is shorthand for an array.
     // In the view you would use $player to access all the columns
     return view('teams.show', compact('team'));
 }
コード例 #14
0
ファイル: FindController.php プロジェクト: lkonga/freedr
 public function acceptFreelancer($id)
 {
     $projectId = Auth::user()->projects()->first()->id;
     // If has project has accepted you
     if (Decision::where('project_id', $projectId)->where('freelancer_id', $id)->where('decision', 1)->count() > 0) {
         Match::create(['project_id' => $projectId, 'freelancer_id' => $id]);
         return redirect()->route('dashboard.matches');
     } else {
         Decision::create(['user_id' => Auth::id(), 'project_id' => $projectId, 'freelancer_id' => $id, 'decision' => 1]);
     }
     return redirect()->route('dashboard.find.freelancers');
 }
コード例 #15
0
 function test_it_works()
 {
     $player = new Player(['nickname' => 'Stefan', 'points' => 11]);
     $opponent = new Player(['nickname' => 'Fredrik', 'points' => 9]);
     $match = Match::create();
     $match->players()->saveMany([$player, $opponent]);
     $this->assertEquals(1, $match->currentSet());
     Event::fire(new App\Events\StartNewSet($match));
     $expected = (object) array('Stefan' => 0, 'Fredrik' => 0);
     $this->assertEquals(2, Match::find($match->id)->currentSet());
     $this->assertEquals($expected, Match::find($match->id)->getScore());
 }
コード例 #16
0
ファイル: Match.php プロジェクト: jenidarnold/racquetball
 public function head2head($player1, $player2)
 {
     //Match detail
     $matches = \DB::table('matches')->join('tournaments', 'tournaments.tournament_id', '=', 'matches.tournament_id')->join('players as winner', 'winner.player_id', '=', 'matches.player1_id')->join('players as loser', 'loser.player_id', '=', 'matches.player2_id')->where(function ($q) use($player1) {
         $q->where('player1_id', '=', $player1)->orWhere('player2_id', '=', $player1);
     })->where(function ($q) use($player2) {
         $q->where('player1_id', '=', $player2)->orWhere('player2_id', '=', $player2);
     })->orderBy('match_division')->orderBy('round')->select('*', 'winner.first_name as winner_first_name', 'winner.last_name as winner_last_name', 'loser.first_name as loser_first_name', 'loser.last_name as loser_last_name', 'loser.player_id as loser_id', 'tournaments.name as tournament')->distinct()->get();
     //Count wins by player
     $player1_wins = Match::where('winner_id', '=', $player1)->where('player2_id', '=', $player2)->get()->count();
     $player2_wins = Match::where('winner_id', '=', $player2)->where('player2_id', '=', $player1)->get()->count();
     $versus = ['player1' => ['wins' => $player1_wins], 'player2' => ['wins' => $player2_wins], 'matches' => $matches];
     return $versus;
 }
コード例 #17
0
ファイル: TestAddPoint.php プロジェクト: stefanledin/mmpingis
 public function test_player1_wins_first_set_and_player2_scores_takes_lead_in_second_set()
 {
     $player1 = Player::create(['points_set1' => 10]);
     $player2 = Player::create(['points_set1' => 9]);
     $match = Match::create(['set' => 1]);
     $match->players()->saveMany([$player1, $player2]);
     $player1->scored();
     $this->assertEquals(1, $match->set);
     $this->assertEquals(11, $player1->points());
     $this->assertEquals(9, $player2->points());
     $player2->scored();
     $this->assertEquals(2, $match->set);
     $this->assertEquals(0, $player1->points());
     $this->assertEquals(1, $player2->points());
 }
コード例 #18
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = \Auth::user();
     $match = Match::find(\Request::input('match'));
     $sheet = $user->getPrimarySheet();
     return \Response::json(['message' => 'You have already be ton this match!'], 422);
     // Status code here
     $this->validate($request, ['match' => 'required', 'team' => 'required', 'amount' => 'required|numeric|between:0,' . $sheet->amount]);
     $bet = new Bet();
     $bet->match_id = \Request::input('match');
     $bet->amount = \Request::input('amount');
     $bet->user()->associate($user);
     $bet->match()->associate($match);
     $bet->sheet()->associate($sheet);
     $bet->save();
     $sheet->amount = $sheet->amount - \Request::input('amount');
     $sheet->save();
     /*return \Auth::check() ? 'authenticated': "NO biiish!";*/
     /*return \Response::json($bet);*/
 }
コード例 #19
0
 /**
  * Download Player Matches
  *
  * @return Response
  */
 public function matches(Request $request)
 {
     $match_player_id = $request->input('player_id');
     $ss = new Scraper();
     $ss->get_matches($match_player_id);
     $match = Match::where('player2_id', '=', $match_player_id)->get();
     return redirect('admin/scraper');
 }
コード例 #20
0
 /**
  * [getPlayerStreak description]
  * @param  [type] $player_id [description]
  * @return [type]            [description]
  */
 public function getPlayerStreak()
 {
     $league_id = Input::get('league_id');
     $player_id = Input::get('player_id');
     $matches = Match::where('player1_id', '=', $player_id)->orWhere('player2_id', '=', $player_id)->orderby('match_date', 'desc')->get();
     if (!is_null($matches)) {
         $last_match = $matches->take(1)->first();
         $count = 0;
         if ($last_match->winner_id == $player_id) {
             $streak = "W";
             //count win streak
             foreach ($matches as $m) {
                 if ($m->winner_id == $player_id) {
                     $count++;
                 } else {
                     break;
                 }
             }
         } else {
             $streak = "L";
             //count loss streak
             foreach ($matches as $m) {
                 if ($m->winner_id != $player_id) {
                     $count++;
                 } else {
                     break;
                 }
             }
         }
     }
     $result = $streak . $count;
     return $result;
 }
コード例 #21
0
ファイル: DataLoader.php プロジェクト: pavelmalai/virtualcsgo
 private function updateResultType($n)
 {
     $matches = Match::select('id', 'team_a', 'team_b', 'winner', 'a_odds', 'b_odds', 'time', 'result_category')->orderBy('time', 'desc')->limit($n)->get();
     foreach ($matches as $match) {
         if ($match->result_category == null or $match->result_category == "NONE") {
             $match->result_category = DataLoader::determineResultType($match);
             $match->save();
         }
     }
 }
コード例 #22
0
ファイル: AddPoint.php プロジェクト: stefanledin/mmpingis
 /**
  * Handle the event.
  *
  * @param  PlayerScoredPoint  $event
  * @return void
  */
 public function handle(PlayerScoredPoint $event)
 {
     $player = $event->player;
     $match = Match::find($player->match->id);
     $match->addPointFor($player);
 }
コード例 #23
0
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     return Match::find($id);
 }
コード例 #24
0
 /**
  * Get matches of the team.
  * @return int
  */
 public function matches()
 {
     return Match::where('team1_id', $this->id)->orWhere('team2_id', $this->id);
 }
コード例 #25
0
ファイル: ScoreController.php プロジェクト: hamhec/zagame
 public function getScore(Request $request)
 {
     $user = Auth::user();
     // Get the last match I closed
     $closed_match = Match::where('concept_id', $request->input('concept_score'))->where('opponent_user_id', $user->id)->orderBy('updated_at', 'desc')->get()->first();
     // Get the last match I opened
     $opened_match = Match::where('concept_id', $request->input('concept_score'))->where('user_id', $user->id)->orderBy('updated_at', 'desc')->get()->first();
     if ($closed_match == null || $opened_match != null && $opened_match->updated_at > $closed_match->updated_at) {
         // Opened a match
         if ($opened_match->opponent_user_id == null) {
             // no one closed my opened match
             $user_associations = $this->getAssociationsForUser($opened_match->concept_id, $user);
             return Response::json(['match' => $opened_match, 'user_associations' => $user_associations]);
         }
         $match = $opened_match;
         $opponent = $match->opponent;
     } else {
         // closed a match
         $match = $closed_match;
         $opponent = $match->user;
     }
     // calculate matchmaking
     $matching = $user->calculateMatching($opponent, $request->input('domain_id'));
     $concept = $match->concept;
     // Load the user's associations
     $user_associations = $this->getAssociationsForUser($concept->id, $user);
     // load the opponent answers and asoociations
     $opponent_associations = $this->getAssociationsForUser($concept->id, $opponent);
     $total_score = 0;
     // calclating Score:
     foreach ($user_associations->associations as $user_association) {
         $user_association->opponent_association = null;
         $user_association->opponent_degree = 85.0;
         foreach ($opponent_associations->associations as $opponent_association) {
             // calculate levenshtein distance
             similar_text(strtoupper($user_association->associated_concept->name), strtoupper($opponent_association->associated_concept->name), $similarity);
             // keep the higher one
             if ($similarity > $user_association->opponent_degree) {
                 $user_association->opponent_degree = $similarity;
                 $user_association->opponent_association = $opponent_association;
             }
         }
         // if there is a similarity
         if ($user_association->opponent_association != null) {
             $score = 100;
             $score -= abs($user_association->weight - $user_association->opponent_association->weight) * 5;
             // take into account similarity
             $score *= $user_association->opponent_degree / 100;
             // take into account Appreciation
             $user_appreciation = null;
             $opponent_appreciation = null;
             if ($user_association->associated_concept->appreciations->count() > 0) {
                 $user_appreciation = $user_association->associated_concept->appreciations->first()->appreciation;
             }
             if ($user_association->opponent_association->associated_concept->appreciations->count() > 0) {
                 $opponent_appreciation = $user_association->opponent_association->associated_concept->appreciations->first()->appreciation;
             }
             if ($user_appreciation != null && $opponent_appreciation != null) {
                 $score -= abs($user_appreciation - $opponent_appreciation) * 10;
             } else {
                 $score -= 3 * 10;
             }
             // take into account Matchmaking
             $score += 5 * (1 - $matching) * 10;
             // add it to total score:
             $user_association->score = floor($score);
             $total_score += $score;
         }
     }
     $total_score = floor($total_score);
     // 1pts for participation
     $total_score += 1;
     if ($match->score == null) {
         $match->score = $total_score;
         $match->save();
     }
     $match->score = $total_score;
     return Response::json(['matching' => $matching, 'match' => $match, 'opponent' => $opponent, 'user_associations' => $user_associations, 'opponent_associations' => $opponent_associations]);
 }
コード例 #26
0
ファイル: TestMatch.php プロジェクト: stefanledin/mmpingis
 public function test_player1_wins_set_and_player2_scores_first_in_second_set()
 {
     $player1 = new Player(['nickname' => 'Stefan', 'points' => 10]);
     $player2 = new Player(['nickname' => 'Fredrik', 'points' => 9]);
     $match = Match::create();
     $match->players()->saveMany([$player1, $player2]);
     $match->addPointFor($player1);
     $expected = (object) array('Stefan' => 11, 'Fredrik' => 9);
     $this->assertEquals($expected, $match->getScore());
     $this->assertEquals(1, Player::find($player1->id)->sets_won);
     $this->assertEquals(0, Player::find($player2->id)->sets_won);
     $match->startNewSet();
     $match->resetPlayerPoints();
     $expected = (object) array('Stefan' => 0, 'Fredrik' => 0);
     $this->assertEquals(2, Match::find($match->id)->currentSet());
     $this->assertEquals($expected, $match->getScore());
     $this->assertEquals(1, Player::find($player1->id)->sets_won);
     $this->assertEquals(0, Player::find($player2->id)->sets_won);
 }
コード例 #27
0
 /**
  * Singel match
  */
 public function show($id)
 {
     $match = Match::find($id);
     return view('match', ['match' => $match, 'players' => $match->players]);
 }
コード例 #28
0
ファイル: WonMatch.php プロジェクト: stefanledin/mmpingis
 /**
  * Handle the event.
  *
  * @param  PlayerWonMatch  $event
  * @return void
  */
 public function handle(PlayerWonMatch $event)
 {
     $match = Match::find($event->player->match->id);
     $match->won_by = $event->player->id;
     $match->save();
 }
コード例 #29
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  Match $match
  * @return \Illuminate\Http\Response
  */
 public function destroy(Match $match)
 {
     $match->delete();
     return redirect('tekme');
 }
コード例 #30
0
 /**
  * Insert new Match
  *
  * @param  array  $data
  * @return Participant
  */
 public function create_match(array $data)
 {
     $players = Player::select('player_id', 'first_name', 'last_name', \DB::raw('CONCAT(first_name, " ", last_name) as full_name'))->lists('player_id', 'full_name');
     //check to see if players exist in Players table
     $err = '';
     if (!array_key_exists($data['player1'], $players)) {
         $err .= '  Not in Players table: ' . $data['player1'];
     }
     if (!array_key_exists($data['player2'], $players)) {
         $err .= '  Not in Players table: ' . $data['player2'];
     }
     if ($err == '') {
         $player1_id = $players[$data['player1']];
         $player2_id = $players[$data['player2']];
         $match = \DB::table('matches')->where('tournament_id', '=', $data['tournament_id'])->where('player1_id', '=', $player1_id)->where('player2_id', '=', $player2_id)->first();
         if (is_null($match)) {
             $match = Match::create(['player1_id' => $player1_id, 'player2_id' => $player2_id, 'winner_id' => $player1_id, 'tournament_id' => $data['tournament_id'], 'match_date' => $data['match_date'], 'match_type' => $data['match_type'], 'match_division' => $data['match_division']]);
         }
     }
 }