Conditions | 1 |
Paths | 1 |
Total Lines | 31 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public function run() |
||
13 | { |
||
14 | $adminGroupId = DB::table('groups')->whereIn('name', 'admin')->select('id')->first()->id; |
||
15 | $adminUserId = DB::table('users')->whereIn('email', '[email protected]')->select('id')->first()->id; |
||
16 | |||
17 | /** |
||
18 | * Assign users to groups. |
||
19 | */ |
||
20 | DB::table('users_groups')->insert( |
||
21 | [ |
||
22 | 'user_id' => $adminUserId, |
||
23 | 'group_id' => $adminGroupId, |
||
24 | 'created_at' => \DB::raw('NOW()'), |
||
25 | 'updated_at' => \DB::raw('NOW()') |
||
26 | ] |
||
27 | ); |
||
28 | |||
29 | /** |
||
30 | * Assign the permissions to the admin group. |
||
31 | */ |
||
32 | DB::table('permissions')->whereIn('model', ['users', 'permissions', 'groups'])->each(function ($permission) use ($adminGroupId) { |
||
33 | DB::table('groups_permissions')->insert( |
||
34 | [ |
||
35 | 'permission_id' => $permission->id, |
||
36 | 'group_id' => $adminGroupId, |
||
37 | 'created_at' => \DB::raw('NOW()'), |
||
38 | 'updated_at' => \DB::raw('NOW()') |
||
39 | ] |
||
40 | ); |
||
41 | }); |
||
42 | } |
||
43 | } |
||
44 |
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.