Conditions | 2 |
Paths | 2 |
Total Lines | 38 |
Code Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function run() |
||
18 | { |
||
19 | Model::unguard(); |
||
20 | |||
21 | $master_prestasis = (object) [ |
||
22 | (object) [ |
||
23 | 'user_id' => '1', |
||
24 | 'jenis_prestasi_id' => '1', |
||
25 | 'juara' => '1', |
||
26 | 'tingkat' => '1', |
||
27 | 'nilai' => '10', |
||
28 | 'bobot' => '1' |
||
29 | ], |
||
30 | (object) [ |
||
31 | 'user_id' => '1', |
||
32 | 'jenis_prestasi_id' => '2', |
||
33 | 'juara' => '2', |
||
34 | 'tingkat' => '2', |
||
35 | 'nilai' => '20', |
||
36 | 'bobot' => '2' |
||
37 | ] |
||
38 | ]; |
||
39 | |||
40 | foreach ($master_prestasis as $master_prestasi) { |
||
41 | $model = MasterPrestasi::updateOrCreate( |
||
42 | [ |
||
43 | 'user_id' => $master_prestasi->user_id, |
||
44 | 'jenis_prestasi_id' => $master_prestasi->jenis_prestasi_id, |
||
45 | 'juara' => $master_prestasi->juara, |
||
46 | 'tingkat' => $master_prestasi->tingkat, |
||
47 | 'nilai' => $master_prestasi->nilai, |
||
48 | 'bobot' => $master_prestasi->bobot, |
||
49 | |||
50 | ] |
||
51 | ); |
||
52 | $model->save(); |
||
53 | } |
||
54 | } |
||
55 | } |
||
58 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.