DatastoreRolesSeeder::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 14
rs 10
1
<?php
2
3
namespace Phpsa\Datastore\Database\Seeds;
4
5
use Illuminate\Database\Seeder;
6
use Spatie\Permission\Models\Role;
0 ignored issues
show
Bug introduced by
The type Spatie\Permission\Models\Role was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Spatie\Permission\Models\Permission;
0 ignored issues
show
Bug introduced by
The type Spatie\Permission\Models\Permission was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
/**
10
 * Class PermissionRoleTableSeeder.
11
 */
12
class DatastoreRolesSeeder extends Seeder
13
{
14
15
    /**
16
     * Run the database seed.
17
     */
18
    public function run()
19
    {
20
21
        // Create Roles
22
        $cms = Role::create(['name' => 'cms']);
23
24
        // Create Permissions
25
        $permissions = ['manage datastore'];
26
27
        foreach ($permissions as $permission) {
28
            Permission::create(['name' => $permission]);
29
		}
30
31
		$cms->givePermissionTo('manage datastore');
32
33
    }
34
}
35