LanguageSeeder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 17 2
1
<?php
2
3
/**
4
 * PWWEB\Localisation\Database\Seeders\Language Seeder.
5
 *
6
 * Standard seeder for the Language Model.
7
 *
8
 * @author    Frank Pillukeit <[email protected]>
9
 * @copyright 2020 pw-websolutions.com
10
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
11
 */
12
13
namespace PWWEB\Localisation\Database\Seeders;
14
15
use Illuminate\Database\Seeder;
16
use Illuminate\Support\Facades\DB;
17
18
class LanguageSeeder extends Seeder
19
{
20
    /**
21
     * Run the database seeds.
22
     *
23
     * @return void
24
     */
25
    public function run()
26
    {
27
        // Initializing variables.
28
        $createdAt = date('Y-m-d H:i:s');
29
        $languages = [];
30
31
        // Definition of default languages.
32
        $languages[] = ['name' => 'English', 'locale' => 'en-GB', 'abbreviation' => 'EN', 'installed' => '1', 'active' => '1', 'standard' => '1'];
33
        $languages[] = ['name' => 'German', 'locale' => 'de-DE', 'abbreviation' => 'DE', 'installed' => '1', 'active' => '1', 'standard' => '0'];
34
35
        foreach ($languages as $id => $language) {
36
            $languages[$id] = array_merge($language, ['created_at' => $createdAt, 'updated_at' => $createdAt]);
37
        }
38
39
        $tableNames = config('pwweb.localisation.table_names');
40
41
        DB::table($tableNames['languages'])->insert($languages);
42
    }
43
}
44