Passed
Branch master (9edb23)
by Provinsi
06:28 queued 03:41
created

BantenprovAnggaranSeederAnggaran::run()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 29
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 19
nc 2
nop 0
dl 0
loc 29
rs 8.8571
c 1
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\Anggaran\Models\Bantenprov\Anggaran\Anggaran;
9
10
class BantenprovAnggaranSeederAnggaran extends Seeder
11
{
12
    /**
13
     * Run the database seeds.
14
     *
15
     * @return void
16
     */
17
	public function run()
18
	{
19
        Model::unguard();
20
21
        $anggarans = (object) [
22
            (object) [
23
                'user_id' => '1',
24
                'group_egovernment_id' => '1',
25
                'label' => 'GroupEgovernment 1',
26
                'description' => 'GroupEgovernment satu'
27
            ],
28
            (object) [
29
                'user_id' => '2',
30
                'group_egovernment_id' => '2',
31
                'label' => 'GroupEgovernment 2',
32
                'description' => 'GroupEgovernment dua',
33
            ]
34
        ];
35
36
        foreach ($anggarans as $anggaran) {
37
            $model = Anggaran::updateOrCreate(
38
                [
39
                    'user_id' => $anggaran->user_id,
40
                    'group_egovernment_id' => $anggaran->group_egovernment_id,
41
                    'label' => $anggaran->label,
42
                    'description' => $anggaran->description,
43
                ]
44
            );
45
            $model->save();
46
        }
47
	}
48
}
49