summaryrefslogtreecommitdiff
path: root/database/seeds/MatchSeeder.php
blob: f0d95f66070320940ea7b367154cf2bf0975fac2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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);
    }
}