TestBinaryUserSeeder::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 23
c 2
b 1
f 0
dl 0
loc 27
rs 9.552
cc 1
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Seeder;
4
use MaksimM\CompositePrimaryKeys\Tests\Stubs\TestBinaryRole;
5
use MaksimM\CompositePrimaryKeys\Tests\Stubs\TestBinaryUser;
6
use MaksimM\CompositePrimaryKeys\Tests\Stubs\TestBinaryUserHex;
7
use MaksimM\CompositePrimaryKeys\Tests\Stubs\TestOrganization;
8
use MaksimM\CompositePrimaryKeys\Tests\Stubs\TestRole;
9
10
class TestBinaryUserSeeder extends Seeder
11
{
12
    /**
13
     * Run the database seeds.
14
     */
15
    public function run()
16
    {
17
        TestBinaryUser::create([
18
            'user_id'         => md5(20000, true),
19
            'organization_id' => TestOrganization::whereName('Foo')
20
                ->first()
21
                ->organization_id,
22
            'name'    => 'Foo',
23
            'role_id' => TestRole::first()->getKey(),
24
        ]);
25
        TestBinaryUser::create([
26
            'user_id'         => md5(20001, true),
27
            'organization_id' => TestOrganization::whereName('Bar')
28
                ->first()
29
                ->organization_id,
30
            'name'           => 'Bar',
31
            'role_id'        => TestRole::first()->getKey(),
32
            'binary_role_id' => TestBinaryRole::first()->getKey(),
33
        ]);
34
        TestBinaryUserHex::create([
35
            'user_id'         => bin2hex(md5(20002, true)),
36
            'organization_id' => TestOrganization::whereName('Bar')
37
                ->first()
38
                ->organization_id,
39
            'name'           => 'Hex',
40
            'role_id'        => TestRole::first()->getKey(),
41
            'binary_role_id' => TestBinaryRole::first()->getKey(),
42
        ]);
43
    }
44
}
45