diff options
Diffstat (limited to 'database/seeds')
-rw-r--r-- | database/seeds/DatabaseSeeder.php | 5 | ||||
-rw-r--r-- | database/seeds/MatchSeeder.php | 58 | ||||
-rw-r--r-- | database/seeds/TeamSeeder.php | 51 | ||||
-rw-r--r-- | database/seeds/TournamentSeeder.php | 21 | ||||
-rw-r--r-- | database/seeds/VenueSeeder.php | 51 |
5 files changed, 185 insertions, 1 deletions
diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 237dfc5..21ec948 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -11,6 +11,9 @@ class DatabaseSeeder extends Seeder */ public function run() { - // $this->call(UserSeeder::class); + $this->call(VenueSeeder::class); + $this->call(TeamSeeder::class); + $this->call(TournamentSeeder::class); + $this->call(MatchSeeder::class); } } diff --git a/database/seeds/MatchSeeder.php b/database/seeds/MatchSeeder.php new file mode 100644 index 0000000..f0d95f6 --- /dev/null +++ b/database/seeds/MatchSeeder.php @@ -0,0 +1,58 @@ +<?php + +use Illuminate\Database\Seeder; +use App\Rugby\Model; + +class MatchSeeder extends Seeder +{ + /** + * Run the database seeds. + * + * @return void + */ + public function run() + { + $match1 = Model\Match::create( + [ + 'venue_id' => 1, + ] + ); + + $match1->teams()->sync( + [ + 1 => ['is_home' => true], + 4 => ['is_home' => false] + ] + ); + + $match2 = Model\Match::create( + [ + 'venue_id' => 2, + ] + ); + + $match2->teams()->sync( + [ + 2 => ['is_home' => true], + 5 => ['is_home' => false] + ] + ); + + $match3 = Model\Match::create( + [ + 'venue_id' => 3, + ] + ); + + $match3->teams()->sync( + [ + 3 => ['is_home' => true], + 6 => ['is_home' => false] + ] + ); + + $match1->tournaments()->sync(1); + $match2->tournaments()->sync(1); + $match3->tournaments()->sync(1); + } +} diff --git a/database/seeds/TeamSeeder.php b/database/seeds/TeamSeeder.php new file mode 100644 index 0000000..250ce94 --- /dev/null +++ b/database/seeds/TeamSeeder.php @@ -0,0 +1,51 @@ +<?php + +use Illuminate\Database\Seeder; +use App\Rugby\Model; + +class TeamSeeder extends Seeder +{ + /** + * Run the database seeds. + * + * @return void + */ + public function run() + { + Model\Team::create( + [ + 'name' => 'England' + ] + ); + + Model\Team::create( + [ + 'name' => 'France' + ] + ); + + Model\Team::create( + [ + 'name' => 'Italy' + ] + ); + + Model\Team::create( + [ + 'name' => 'Wales' + ] + ); + + Model\Team::create( + [ + 'name' => 'Scotland' + ] + ); + + Model\Team::create( + [ + 'name' => 'Ireland' + ] + ); + } +} diff --git a/database/seeds/TournamentSeeder.php b/database/seeds/TournamentSeeder.php new file mode 100644 index 0000000..070e0fb --- /dev/null +++ b/database/seeds/TournamentSeeder.php @@ -0,0 +1,21 @@ +<?php + +use Illuminate\Database\Seeder; +use App\Rugby; + +class TournamentSeeder extends Seeder +{ + /** + * Run the database seeds. + * + * @return void + */ + public function run() + { + Rugby\Tournament::create( + [ + 'name' => 'RBS Six Nations' + ] + ); + } +} diff --git a/database/seeds/VenueSeeder.php b/database/seeds/VenueSeeder.php new file mode 100644 index 0000000..f95e4ef --- /dev/null +++ b/database/seeds/VenueSeeder.php @@ -0,0 +1,51 @@ +<?php + +use Illuminate\Database\Seeder; +use App\Rugby\Model; + +class VenueSeeder extends Seeder +{ + /** + * Run the database seeds. + * + * @return void + */ + public function run() + { + Model\Venue::create( + [ + 'name' => 'Twickenham' + ] + ); + + Model\Venue::create( + [ + 'name' => 'Stade de France' + ] + ); + + Model\Venue::create( + [ + 'name' => 'Stadio Olimpico' + ] + ); + + Model\Venue::create( + [ + 'name' => 'Millennium Stadium' + ] + ); + + Model\Venue::create( + [ + 'name' => 'Murrayfield Stadium' + ] + ); + + Model\Venue::create( + [ + 'name' => 'Aviva Stadium' + ] + ); + } +} |