Ejemplo n.º 1
0
 public function players()
 {
     $teamIds = $this->teams->modelKeys();
     return Player::whereHas('teams', function ($q) use($teamIds) {
         $q->whereIn('id', $teamIds);
     });
 }
Ejemplo n.º 2
0
 /**
  * @test
  */
 public function editExistingRegistration()
 {
     // get a player for this season that is registered
     $currentSeason = $this->season();
     $player = Player::whereHas('seasons', function ($q) use($currentSeason) {
         $q->where('seasons.id', $currentSeason->id);
     })->firstOrFail();
     $this->guardian = $player->guardian;
     $this->actingAs($this->guardian);
     // the test
     $this->visit('/dashboard')->click('#edit-child-' . $player->id)->select(rand(3, 12), 'grade')->select(array_rand(['S', 'M', 'L', 'XL']), 'shirt_size')->submitForm('Save')->see('Your changes were saved');
 }