예제 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     if (\App\Models\League::where(['name' => 'Liga BBVA'])->count() > 0) {
         return false;
     }
     $league = \App\Models\League::firstOrNew(['name' => 'Liga BBVA', 'logoPath' => 'leagues-logo/liga-bbva.png']);
     $league->save();
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Athletic Club', 'logoPath' => 'teams-logo/athletic.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Atlético Madrid', 'logoPath' => 'teams-logo/atletico.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Celta de Vigo', 'logoPath' => 'teams-logo/celta.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Deportivo La Coruña', 'logoPath' => 'teams-logo/deportivo.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Eibar', 'logoPath' => 'teams-logo/eibar.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'FC Barcelona', 'logoPath' => 'teams-logo/barcelona.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Getafe CF', 'logoPath' => 'teams-logo/getafe.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Granada CF', 'logoPath' => 'teams-logo/granada.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Las Palmas', 'logoPath' => 'teams-logo/las-palmas.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Levante UD', 'logoPath' => 'teams-logo/levante.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Málaga CF', 'logoPath' => 'teams-logo/malaga.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Rayo Vallecano', 'logoPath' => 'teams-logo/rayo.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'RCD Espanyol', 'logoPath' => 'teams-logo/espanyol.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Real Betis', 'logoPath' => 'teams-logo/betis.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Real Madrid CF', 'logoPath' => 'teams-logo/real-madrid.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Real Sociedad', 'logoPath' => 'teams-logo/sociedad.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Sevilla FC', 'logoPath' => 'teams-logo/sevilla.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Sporting Gijón', 'logoPath' => 'teams-logo/sporting.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Valencia', 'logoPath' => 'teams-logo/valencia.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Villarreal CF', 'logoPath' => 'teams-logo/villarreal.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
 }
예제 #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $league = \App\Models\League::where(['name' => 'Bundesliga'])->first();
     if ($league) {
         if (\App\Models\Team::where(['leagueId' => $league->id])->count() > 2) {
             return false;
         }
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Schalke 04', 'logoPath' => 'teams-logo/schalke04.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Hertha BSC', 'logoPath' => 'teams-logo/hertha.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => '1. FC Köln', 'logoPath' => 'teams-logo/koln.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'FC Ingolstadt 04', 'logoPath' => 'teams-logo/ingolstadt.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Bayer Leverkusen', 'logoPath' => 'teams-logo/leverkusen.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => '1. FSV Mainz 05', 'logoPath' => 'teams-logo/mainz.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'VfL Wolfsburg', 'logoPath' => 'teams-logo/wolfsburg.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'SV Darmstadt 98', 'logoPath' => 'teams-logo/darmstadt.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Hamburger SV', 'logoPath' => 'teams-logo/hamburger.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Eintracht Frankfurt', 'logoPath' => 'teams-logo/eintracht.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Borussia Mönchengladbach', 'logoPath' => 'teams-logo/munchengladbach.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Werder Bremen', 'logoPath' => 'teams-logo/werder.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Hoffenheim', 'logoPath' => 'teams-logo/hoffenheim.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'FC Augsburg', 'logoPath' => 'teams-logo/augsburg.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Hannover 96', 'logoPath' => 'teams-logo/hannover.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'VfB Stuttgart', 'logoPath' => 'teams-logo/stuttgart.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     } else {
         $league = \App\Models\League::firstOrNew(['name' => 'Bundesliga', 'logoPath' => 'leagues-logo/bundesliga.png']);
         $league->save();
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'FC Bayern Munich', 'logoPath' => 'teams-logo/bayern.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Borussia Dortmund', 'logoPath' => 'teams-logo/dortmund.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     }
 }
예제 #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     if (\App\Models\League::where(['name' => 'Seria A TIM'])->count() > 0) {
         return false;
     }
     $league = \App\Models\League::firstOrNew(['name' => 'Seria A TIM', 'logoPath' => 'leagues-logo/seriaa-tim.png']);
     $league->save();
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'AC Milan', 'logoPath' => 'teams-logo/milan.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'AS Roma', 'logoPath' => 'teams-logo/roma.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Atalanta', 'logoPath' => 'teams-logo/atalanta.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Bologna', 'logoPath' => 'teams-logo/bologna.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Carpi', 'logoPath' => 'teams-logo/carpi.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Chievo', 'logoPath' => 'teams-logo/chievo.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Empoli', 'logoPath' => 'teams-logo/empoli.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Frosinone', 'logoPath' => 'teams-logo/frosinone.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Fiorentina', 'logoPath' => 'teams-logo/fiorentina.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Genoa', 'logoPath' => 'teams-logo/genoa.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Hellas Verona', 'logoPath' => 'teams-logo/verona.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Inter', 'logoPath' => 'teams-logo/inter.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Juventus', 'logoPath' => 'teams-logo/juventus.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Lazio', 'logoPath' => 'teams-logo/lazio.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Napoli', 'logoPath' => 'teams-logo/napoli.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Palermo', 'logoPath' => 'teams-logo/palermo.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Sampdoria', 'logoPath' => 'teams-logo/sampdoria.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Sassuolo', 'logoPath' => 'teams-logo/sassuolo.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Torino', 'logoPath' => 'teams-logo/torino.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Udinese', 'logoPath' => 'teams-logo/udinese.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
 }
예제 #4
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     if (\App\Models\League::where(['name' => 'Ligue 1'])->count() > 0) {
         return false;
     }
     $league = \App\Models\League::firstOrNew(['name' => 'Ligue 1', 'logoPath' => 'leagues-logo/ligue1.png']);
     $league->save();
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'AS Monaco FC', 'logoPath' => 'teams-logo/monaco.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Paris Saint-Germain', 'logoPath' => 'teams-logo/psg.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
 }
예제 #5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     if (\App\Models\League::where(['name' => 'Barclays Premier League'])->count() > 0) {
         return false;
     }
     $league = \App\Models\League::firstOrNew(['name' => 'Barclays Premier League', 'logoPath' => 'leagues-logo/barclays-premier-league.png']);
     $league->save();
     $teams = [['name' => 'Arsenal', 'logoPath' => 'teams-logo/arsenal.png'], ['name' => 'Aston Villa', 'logoPath' => 'teams-logo/aston-villa.png'], ['name' => 'Bournemouth', 'logoPath' => 'teams-logo/bournemouth.png'], ['name' => 'Chelsea', 'logoPath' => 'teams-logo/chelsea.png'], ['name' => 'Crystal Palace', 'logoPath' => 'teams-logo/crystal-palace.png'], ['name' => 'Everton', 'logoPath' => 'teams-logo/everton.png'], ['name' => 'Leicester', 'logoPath' => 'teams-logo/leicester.png'], ['name' => 'Liverpool', 'logoPath' => 'teams-logo/liverpool.png'], ['name' => 'Man City', 'logoPath' => 'teams-logo/manchester-city.png'], ['name' => 'Man Utd', 'logoPath' => 'teams-logo/manchester-utd.png'], ['name' => 'Newcastle', 'logoPath' => 'teams-logo/newcastle-utd.png'], ['name' => 'Norwich', 'logoPath' => 'teams-logo/norwich.png'], ['name' => 'Southampton', 'logoPath' => 'teams-logo/southampton.png'], ['name' => 'Stoke', 'logoPath' => 'teams-logo/stoke.png'], ['name' => 'Sunderland', 'logoPath' => 'teams-logo/sunderland.png'], ['name' => 'Swansea', 'logoPath' => 'teams-logo/swansea.png'], ['name' => 'Spurs', 'logoPath' => 'teams-logo/tottenham.png'], ['name' => 'Watford', 'logoPath' => 'teams-logo/watford.png'], ['name' => 'West Brom', 'logoPath' => 'teams-logo/west-brom.png'], ['name' => 'West Ham', 'logoPath' => 'teams-logo/west-ham.png']];
     foreach ($teams as $team) {
         DB::table('teams')->insert(['leagueId' => $league->id, 'name' => $team['name'], 'logoPath' => $team['logoPath'], 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     }
 }
예제 #6
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     if (\App\Models\League::where(['name' => 'National teams'])->count() > 0) {
         return false;
     }
     $league = \App\Models\League::firstOrNew(['name' => 'National teams', 'logoPath' => 'leagues-logo/national-teams.png']);
     $league->save();
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Argentina', 'logoPath' => 'teams-logo/argentina.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Brazil', 'logoPath' => 'teams-logo/brazil.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Germany', 'logoPath' => 'teams-logo/germany.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Italy', 'logoPath' => 'teams-logo/italy.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     DB::table('teams')->insert(['leagueId' => $league->id, 'name' => 'Spain', 'logoPath' => 'teams-logo/spain.png', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
 }
예제 #7
0
 /**
  * Create new league
  *
  * @param CreateLeague $request
  * @return array
  */
 public function store(CreateLeague $request)
 {
     $league = League::create($request->input('league'));
     return $this->response->collection(League::where(['id' => $league->id])->get(), new LeagueTransformer(), 'leagues');
 }