Conditions | 1 |
Paths | 1 |
Total Lines | 29 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
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 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.