Completed
Push — dev ( 6a93ce...82e8fe )
by Zach
03:22
created

PagesTableSeeder::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 14
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
nc 2
nop 0
dl 14
loc 14
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
namespace Larafolio\database\seeds;
4
5
use Larafolio\Models\Link;
6
use Larafolio\Models\Page;
7
use Illuminate\Database\Seeder;
8
use Larafolio\Models\TextBlock;
9
10 View Code Duplication
class PagesTableSeeder extends Seeder
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    /**
13
     * Run the database seeds.
14
     *
15
     * @return void
16
     */
17
    public function run()
18
    {
19
        foreach (range(1, 5) as $i) {
20
            $name = 'Page'.$i;
21
22
            factory(Page::class)
23
                ->create(['name' => $name])
24
                ->each(function (Page $project) {
25
                    $project->blocks()->save(factory(TextBlock::class)->make());
26
27
                    $project->links()->save(factory(Link::class)->make());
28
                });
29
        }
30
    }
31
}