Completed
Push — master ( f65d8f...4f3de5 )
by Pavel
04:14 queued 01:54
created

CreateRolesRightsUsers   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

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