Completed
Push — master ( 9e59ff...11ca4d )
by Abdelrahman
66:39 queued 62:06
created

CortexAuthSeeder::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 54

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 54
rs 9.0036
c 0
b 0
f 0
cc 1
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
declare(strict_types=1);
4
5
use Illuminate\Database\Seeder;
6
7
class CortexAuthSeeder extends Seeder
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...
8
{
9
    /**
10
     * Run the database seeds.
11
     *
12
     * @return void
13
     */
14
    public function run()
15
    {
16
        Bouncer::allow('superadmin')->everything();
17
18
        $abilities = [
19
            ['name' => 'list', 'title' => 'List abilities', 'entity_type' => 'ability'],
20
            ['name' => 'import', 'title' => 'Import abilities', 'entity_type' => 'ability'],
21
            ['name' => 'create', 'title' => 'Create abilities', 'entity_type' => 'ability'],
22
            ['name' => 'update', 'title' => 'Update abilities', 'entity_type' => 'ability'],
23
            ['name' => 'delete', 'title' => 'Delete abilities', 'entity_type' => 'ability'],
24
            ['name' => 'audit', 'title' => 'Audit abilities', 'entity_type' => 'ability'],
25
            ['name' => 'grant', 'title' => 'Grant abilities', 'entity_type' => 'ability'],
26
27
            ['name' => 'list', 'title' => 'List roles', 'entity_type' => 'role'],
28
            ['name' => 'import', 'title' => 'Import roles', 'entity_type' => 'role'],
29
            ['name' => 'create', 'title' => 'Create roles', 'entity_type' => 'role'],
30
            ['name' => 'update', 'title' => 'Update roles', 'entity_type' => 'role'],
31
            ['name' => 'delete', 'title' => 'Delete roles', 'entity_type' => 'role'],
32
            ['name' => 'audit', 'title' => 'Audit roles', 'entity_type' => 'role'],
33
            ['name' => 'assign', 'title' => 'Assign roles', 'entity_type' => 'role'],
34
35
            ['name' => 'list', 'title' => 'List admins', 'entity_type' => 'admin'],
36
            ['name' => 'import', 'title' => 'Import admins', 'entity_type' => 'admin'],
37
            ['name' => 'create', 'title' => 'Create admins', 'entity_type' => 'admin'],
38
            ['name' => 'update', 'title' => 'Update admins', 'entity_type' => 'admin'],
39
            ['name' => 'delete', 'title' => 'Delete admins', 'entity_type' => 'admin'],
40
            ['name' => 'audit', 'title' => 'Audit admins', 'entity_type' => 'admin'],
41
42
            ['name' => 'list', 'title' => 'List members', 'entity_type' => 'member'],
43
            ['name' => 'import', 'title' => 'Import members', 'entity_type' => 'member'],
44
            ['name' => 'create', 'title' => 'Create members', 'entity_type' => 'member'],
45
            ['name' => 'update', 'title' => 'Update members', 'entity_type' => 'member'],
46
            ['name' => 'delete', 'title' => 'Delete members', 'entity_type' => 'member'],
47
            ['name' => 'audit', 'title' => 'Audit members', 'entity_type' => 'member'],
48
49
            ['name' => 'list', 'title' => 'List managers', 'entity_type' => 'manager'],
50
            ['name' => 'import', 'title' => 'Import managers', 'entity_type' => 'manager'],
51
            ['name' => 'create', 'title' => 'Create managers', 'entity_type' => 'manager'],
52
            ['name' => 'update', 'title' => 'Update managers', 'entity_type' => 'manager'],
53
            ['name' => 'delete', 'title' => 'Delete managers', 'entity_type' => 'manager'],
54
            ['name' => 'audit', 'title' => 'Audit managers', 'entity_type' => 'manager'],
55
56
            ['name' => 'list', 'title' => 'List guardians', 'entity_type' => 'guardian'],
57
            ['name' => 'import', 'title' => 'Import guardians', 'entity_type' => 'guardian'],
58
            ['name' => 'create', 'title' => 'Create guardians', 'entity_type' => 'guardian'],
59
            ['name' => 'update', 'title' => 'Update guardians', 'entity_type' => 'guardian'],
60
            ['name' => 'delete', 'title' => 'Delete guardians', 'entity_type' => 'guardian'],
61
            ['name' => 'audit', 'title' => 'Audit guardians', 'entity_type' => 'guardian'],
62
        ];
63
64
        collect($abilities)->each(function (array $ability) {
65
            app('cortex.auth.ability')->create($ability);
66
        });
67
    }
68
}
69