Completed
Pull Request — master (#4037)
by Muhlis
02:38
created

UserTableSeeder   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 75 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 9
loc 12
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Tests\Seeds;
4
5
use Illuminate\Database\Seeder;
6
7
class UserTableSeeder extends Seeder
8
{
9
    public function run()
10
    {
11
        factory(\Tests\Models\User::class, 50)
12
            ->create()
13
            ->each(function ($u) {
14
                $u->profile()->save(factory(\Tests\Models\Profile::class)->make());
15
                $u->tags()->saveMany(factory(\Tests\Models\Tag::class, 5)->make());
16
            });
17
    }
18
}
19