Completed
Push — master ( f9e78a...edb43e )
by Abdelrahman
09:22
created

AbilitiesSeeder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 15 2
1
<?php
2
3
/*
4
 * NOTICE OF LICENSE
5
 *
6
 * Part of the Rinvex Fort Package.
7
 *
8
 * This source file is subject to The MIT License (MIT)
9
 * that is bundled with this package in the LICENSE file.
10
 *
11
 * Package: Rinvex Fort Package
12
 * License: The MIT License (MIT)
13
 * Link:    https://rinvex.com
14
 */
15
16
namespace Rinvex\Fort\Seeds;
17
18
use Rinvex\Fort\Models\Ability;
19
use Illuminate\Database\Seeder;
20
use Illuminate\Support\Facades\DB;
21
22
class AbilitiesSeeder extends Seeder
23
{
24
    /**
25
     * Run the database seeds.
26
     *
27
     * @return void
28
     */
29
    public function run()
30
    {
31
        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
32
        DB::table(config('rinvex.fort.tables.abilities'))->truncate();
33
34
        // Get abilities data
35
        $abilities = json_decode(file_get_contents(__DIR__.'/../../resources/data/abilities.json'), true);
36
37
        // Create new abilities
38
        foreach ($abilities as $ability) {
39
            Ability::create($ability);
40
        }
41
42
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');
43
    }
44
}
45