ExperienceSkillSeeder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 24
dl 0
loc 39
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 32 2
1
<?php
2
3
use App\Models\Skill;
4
use App\Models\ExperienceWork;
5
use App\Models\ExperienceAward;
6
use App\Models\ExperiencePersonal;
7
use App\Models\ExperienceCommunity;
8
use App\Models\ExperienceEducation;
9
use Illuminate\Database\Seeder;
10
11
class ExperienceSkillSeeder extends Seeder // phpcs:ignore
12
{
13
    /**
14
     * Run the Experience Skills seeds.
15
     *
16
     * @return void
17
     */
18
    public function run()
19
    {
20
        factory(ExperienceWork::class, 8)->create();
0 ignored issues
show
Bug introduced by
The function factory was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        /** @scrutinizer ignore-call */ 
21
        factory(ExperienceWork::class, 8)->create();
Loading history...
21
        factory(ExperienceAward::class, 5)->create();
22
        factory(ExperiencePersonal::class, 6)->create();
23
        factory(ExperienceEducation::class, 7)->create();
24
        factory(ExperienceCommunity::class, 4)->create();
25
26
        $skills = Skill::all();
27
28
        foreach ($skills as $skill) {
29
            $skill->experiences_work()
30
                ->attach(ExperienceWork::inRandomOrder()->first(), [
31
                    'justification' => 'Because I had some job.'
32
                ]);
33
            $skill->experiences_personal()
34
                ->attach(ExperiencePersonal::inRandomOrder()->first(), [
35
                    'justification' => 'Because I did this thing.'
36
                ]);
37
            $skill->experiences_education()
38
                ->attach(ExperienceEducation::inRandomOrder()->first(), [
39
                    'justification' => 'Because a piece of paper has my name on it.'
40
                ]);
41
            $skill->experiences_award()
42
                ->attach(ExperienceAward::inRandomOrder()->first(), [
43
                    'justification' => 'Because I got a prize for participating.'
44
                ]);
45
            $skill->experiences_community()
46
                ->attach(ExperienceCommunity::inRandomOrder()->first(), [
47
                    'justification' => 'Because I am a communist.'
48
                ]);
49
            $skill->save();
50
        }
51
    }
52
}
53