Completed
Push — master ( edb9ee...b465c5 )
by
unknown
10:14
created

LocalesTableSeeder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 14 3
1
<?php
2
3
namespace BBSLab\NovaTranslation\Seeders;
4
5
use BBSLab\NovaTranslation\Models\Locale;
6
use Illuminate\Database\Seeder;
7
8
class LocalesTableSeeder extends Seeder
9
{
10
    /**
11
     * Table seeder.
12
     *
13
     * @return void
14
     */
15
    public function run()
16
    {
17
        $locales = ['en' => 'English', 'fr' => 'Français'];
18
        $defaultIso = array_keys($locales)[0];
19
20
        foreach ($locales as $iso => $label) {
21
            Locale::query()->create([
22
                'iso' => $iso,
23
                'label' => $label,
24
                'fallback_id' => ($iso === $defaultIso) ? null : 1,
25
                'available_in_api' => true,
26
            ]);
27
        }
28
    }
29
}
30