CreateRolesRightsUsers::run()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 29
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 21
nc 1
nop 0
dl 0
loc 29
rs 8.8571
c 0
b 0
f 0
1
<?php
2
use App\Model\Role;
3
use App\Model\User;
4
5
class CreateRolesRightsUsers
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
6
{
7
    public function run()
8
    {
9
        Role::create([
10
            'name'        => 'admin',
11
            'description' => 'Администратор',
12
        ]);
13
        Role::create([
14
            'name'        => 'user',
15
            'description' => 'Пользователь',
16
        ]);
17
18
        $user = new User();
19
20
        $user->email     = '[email protected]';
21
        $user->full_name = 'Администратор';
22
        $user->password  = password_hash('qwerty', PASSWORD_DEFAULT, ['cost' => 13]);
23
        $user->role_id   = User::ROLE_ADMIN;
24
        $user->status    = User::STATUS_ACTIVE;
25
        $user->save();
26
27
        $user = new User();
28
29
        $user->email     = '[email protected]';
30
        $user->full_name = 'Пользователь';
31
        $user->password  = password_hash('qwerty', PASSWORD_DEFAULT, ['cost' => 13]);
32
        $user->role_id   = User::ROLE_USER;
33
        $user->status    = User::STATUS_ACTIVE;
34
        $user->save();
35
    }
36
}
37