Passed
Push — release/1.0.15 ( c45e46...a1cbee )
by Grant
06:39 queued 10s
created

SkillClassificationSeeder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
dl 0
loc 16
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 9 2
1
<?php
2
3
use Illuminate\Database\Seeder;
4
5
use App\Models\Classification;
6
use App\Models\Skill;
7
8
class SkillClassificationSeeder extends Seeder // phpcs:ignore
9
{
10
    /**
11
     * Run the Skills Classification seeds.
12
     *
13
     * @return void
14
     */
15
    public function run()
16
    {
17
        $skills = Skill::all();
18
19
        foreach ($skills as $skill) {
20
            $skill->classifications()->attach(Classification::inRandomOrder()->first());
21
            $skill->is_culture_skill = (bool)random_int(0, 1);
22
            $skill->is_future_skill = (bool)random_int(0, 1);
23
            $skill->save();
24
        }
25
    }
26
}
27