| Conditions | 2 |
| Paths | 2 |
| Total Lines | 27 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function run() |
||
| 18 | { |
||
| 19 | Model::unguard(); |
||
| 20 | |||
| 21 | $prestasis = (object) [ |
||
| 22 | (object) [ |
||
| 23 | 'label' => 'Prestasi 1', |
||
| 24 | 'description' => 'Prestasi 1', |
||
| 25 | ], |
||
| 26 | (object) [ |
||
| 27 | 'label' => 'Prestasi 2', |
||
| 28 | 'description' => 'Prestasi 2', |
||
| 29 | ] |
||
| 30 | ]; |
||
| 31 | |||
| 32 | foreach ($prestasis as $prestasi) { |
||
| 33 | $model = Prestasi::updateOrCreate( |
||
| 34 | [ |
||
| 35 | 'label' => $prestasi->label, |
||
| 36 | ], |
||
| 37 | [ |
||
| 38 | 'description' => $prestasi->description, |
||
| 39 | ] |
||
| 40 | ); |
||
| 41 | $model->save(); |
||
| 42 | } |
||
| 43 | } |
||
| 44 | } |
||
| 45 |
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.