Passed
Push — dependabot/npm_and_yarn/dev/sa... ( 003e03...a9167e )
by Yonathan
06:21 queued 12s
created

CommentSeeder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 8 2
1
<?php
2
3
use App\Models\Comment;
4
use App\Models\JobPoster;
5
use App\Models\User;
6
use Illuminate\Database\Seeder;
7
8
class CommentSeeder extends Seeder // phpcs:ignore
9
{
10
    /**
11
     * Run the database seeds.
12
     *
13
     * @return void
14
     */
15
    public function run(): void
16
    {
17
        $job_posters = JobPoster::all();
18
19
        foreach ($job_posters as $job_poster) {
20
            $job_poster->comments()->saveMany(factory(Comment::class, 3)->make([
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
            $job_poster->comments()->saveMany(/** @scrutinizer ignore-call */ factory(Comment::class, 3)->make([
Loading history...
21
                'job_poster_id' => $job_poster->id,
22
                'user_id' => $job_poster->manager->user_id,
23
            ]));
24
        }
25
    }
26
}
27