Completed
Push — master ( 33abc3...91448a )
by
unknown
9s
created

BantenprovVueOpdSeederVueOpd   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 15 1
1
<?php
2
3
/* Require */
4
use Illuminate\Database\Seeder;
5
use Illuminate\Database\Eloquent\Model;
6
7
/* Models */
8
use Bantenprov\VueOpd\Models\Bantenprov\VueOpd\VueOpd;
9
10
class BantenprovVueOpdSeederVueOpd extends Seeder
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
11
{
12
    /**
13
     * Run the database seeds.
14
     *
15
     * @return void
16
     */
17
    public function run()
18
    {
19
        Model::unguard();
20
21
        $model      = new VueOpd;
22
        $file       = file_get_contents(public_path('json/bantenprov/vue-opd/vue-opd-data.json'));
23
        $json       = json_decode($file, true);
24
        $vue_opds   = array_get($json, '2.data');
25
26
        $model::truncate();
27
28
        DB::table($model->getTable())->insert(
29
            $vue_opds
30
        );
31
    }
32
}
33