Completed
Push — master ( c1d7cf...cc10b4 )
by
unknown
13s
created

BantenprovPrestasiSeederJenisPrestasi::run()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 26
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 14
nc 2
nop 0
dl 0
loc 26
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
/* Require */
4
use Illuminate\Database\Seeder;
5
use Illuminate\Database\Eloquent\Model;
6
7
/* Models */
8
use Bantenprov\Prestasi\Models\Bantenprov\Prestasi\JenisPrestasi;
9
10
class BantenprovPrestasiSeederJenisPrestasi 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
        $jenis_prestasis = (object) [
22
            (object) [
23
                'user_id' => '1',
24
                'nama_jenis_prestasi' => '1'               
25
            ],
26
            (object) [
27
                'user_id' => '1',
28
                'nama_jenis_prestasi' => '2'            
29
            ]
30
        ];
31
32
        foreach ($jenis_prestasis as $jenis_prestasi) {
33
            $model = JenisPrestasi::updateOrCreate(
34
                [
35
                   'user_id' => $jenis_prestasi->user_id,
36
                   'nama_jenis_prestasi' => $jenis_prestasi->nama_jenis_prestasi
37
38
                ]
39
            );
40
            $model->save();
41
        }
42
	}
43
}
44
45
46