1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Illuminate\Support\Facades\Schema; |
4
|
|
|
use Illuminate\Database\Schema\Blueprint; |
5
|
|
|
use Illuminate\Database\Migrations\Migration; |
6
|
|
|
|
7
|
|
|
class PopulateRelationships extends Migration |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* Run the migrations. |
11
|
|
|
* |
12
|
|
|
* @return void |
13
|
|
|
*/ |
14
|
|
|
public function up() |
15
|
|
|
{ |
16
|
|
|
DB::table('relationships')->insert([ |
17
|
|
|
['id' => 1, 'name' => 'superior'], |
18
|
|
|
['id' => 2, 'name' => 'coworker'], |
19
|
|
|
['id' => 3, 'name' => 'subordinate'], |
20
|
|
|
]); |
21
|
|
|
|
22
|
|
|
DB::table('relationship_translations')->insert([ |
23
|
|
|
['id' => 1, 'relationship_id' => 1, 'locale' => 'en', 'value' => 'Superior'], |
24
|
|
|
['id' => 2, 'relationship_id' => 1, 'locale' => 'fr', 'value' => 'Supérieur'], |
25
|
|
|
['id' => 3, 'relationship_id' => 2, 'locale' => 'en', 'value' => 'Coworker'], |
26
|
|
|
['id' => 4, 'relationship_id' => 2, 'locale' => 'fr', 'value' => 'Collaborateur'], |
27
|
|
|
['id' => 5, 'relationship_id' => 3, 'locale' => 'en', 'value' => 'Subordinate'], |
28
|
|
|
['id' => 6, 'relationship_id' => 3, 'locale' => 'fr', 'value' => 'Subalterne'], |
29
|
|
|
]); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Reverse the migrations. |
34
|
|
|
* |
35
|
|
|
* @return void |
36
|
|
|
*/ |
37
|
|
|
public function down() |
38
|
|
|
{ |
39
|
|
|
DB::table('relationships')->whereIn('id', [1, 2, 3])->delete(); |
40
|
|
|
DB::table('relationship_translations')->whereIn('id', [1, 2, 3, 4, 5, 6])->delete(); |
41
|
|
|
} |
42
|
|
|
} |
43
|
|
|
|