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

LocalesTableSeeder::run()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 3
nc 2
nop 0
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