Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function run() |
||
18 | { |
||
19 | Model::unguard(); |
||
20 | |||
21 | $users = (object) [ |
||
22 | (object) [ |
||
23 | 'name' => 'Administrator', |
||
24 | 'email' => '[email protected]', |
||
25 | 'password' => '123456' |
||
26 | ] |
||
27 | ]; |
||
28 | |||
29 | foreach ($users as $user) { |
||
30 | $model = User::updateOrCreate( |
||
31 | [ |
||
32 | 'name' => $user->name, |
||
33 | 'email' => $user->email, |
||
34 | 'password' => bcrypt($user->password), |
||
35 | ] |
||
36 | ); |
||
37 | $model->save(); |
||
38 | } |
||
39 | } |
||
40 | } |
||
41 |
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.