Completed
Push — master ( 52970f...c6d773 )
by Tristan
24:57 queued 10:40
created

PopulateLanguageRequirements::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 15
rs 9.9
cc 1
nc 1
nop 0
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class PopulateLanguageRequirements extends Migration
8
{
9
    /**
10
    * Run the migrations.
11
    *
12
    * @return void
13
    */
14
    public function up()
15
    {
16
        DB::table('language_requirements')->insert([
17
            ['id' => 1, 'name' => 'english'],
18
            ['id' => 2, 'name' => 'french'],
19
            ['id' => 3, 'name' => 'bilingual'],
20
        ]);
21
22
        DB::table('language_requirement_translations')->insert([
23
            ['id' => 1, 'language_requirement_id' => 1, 'locale' => 'en', 'value' => 'English essential'],
24
            ['id' => 2, 'language_requirement_id' => 1, 'locale' => 'fr', 'value' => 'Anglais essentiel'],
25
            ['id' => 3, 'language_requirement_id' => 2, 'locale' => 'en', 'value' => 'French essential'],
26
            ['id' => 4, 'language_requirement_id' => 2, 'locale' => 'fr', 'value' => 'Français essentiel'],
27
            ['id' => 5, 'language_requirement_id' => 3, 'locale' => 'en', 'value' => 'Bilingual'],
28
            ['id' => 6, 'language_requirement_id' => 3, 'locale' => 'fr', 'value' => 'Bilingue'],
29
        ]);
30
    }
31
32
    /**
33
    * Reverse the migrations.
34
    *
35
    * @return void
36
    */
37
    public function down()
38
    {
39
        DB::table('language_requirements')->whereIn('id', [1, 2, 3])->delete();
40
        DB::table('language_requirement_translations')->whereIn('id', [1, 2, 3, 4, 5, 6])->delete();
41
    }
42
}
43