SentryGroupSeedTableSeeder::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 74
Code Lines 57

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
dl 0
loc 74
rs 9.0336
c 3
b 0
f 1
cc 1
eloc 57
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 namespace Modules\User\Database\Seeders;
2
3
use Cartalyst\Sentry\Facades\Laravel\Sentry;
4
use Illuminate\Database\Eloquent\Model;
5
use Illuminate\Database\Seeder;
6
7
class SentryGroupSeedTableSeeder extends Seeder
8
{
9
    /**
10
     * Run the database seeds.
11
     *
12
     * @return void
13
     */
14
    public function run()
15
    {
16
        Model::unguard();
17
18
        // Create an Admin group
19
        Sentry::createGroup(array(
20
            'name'        => 'Admin',
21
            'permissions' => [
22
                'dashboard.index' => 1,
23
                'dashboard.grid.save' => 1,
24
                'dashboard.grid.reset' => 1,
25
                /* Workbench */
26
                'workshop.modules.index' => 1,
27
                'workshop.modules.show' => 1,
28
                'workshop.modules.disable' => 1,
29
                'workshop.modules.enable' => 1,
30
                /* Roles */
31
                'user.roles.index' => 1,
32
                'user.roles.create' => 1,
33
                'user.roles.store' => 1,
34
                'user.roles.edit' => 1,
35
                'user.roles.update' => 1,
36
                'user.roles.destroy' => 1,
37
                /* Users */
38
                'user.users.index' => 1,
39
                'user.users.create' => 1,
40
                'user.users.store' => 1,
41
                'user.users.edit' => 1,
42
                'user.users.update' => 1,
43
                'user.users.destroy' => 1,
44
                /* Menu */
45
                'menu.menus.index' => 1,
46
                'menu.menus.create' => 1,
47
                'menu.menus.store' => 1,
48
                'menu.menus.edit' => 1,
49
                'menu.menus.update' => 1,
50
                'menu.menus.destroy' => 1,
51
                'menu.menuitem.index' => 1,
52
                'menu.menuitem.create' => 1,
53
                'menu.menuitem.store' => 1,
54
                'menu.menuitem.edit' => 1,
55
                'menu.menuitem.update' => 1,
56
                'menu.menuitem.destroy' => 1,
57
                /* Media */
58
                'media.media.index' => 1,
59
                'media.media.create' => 1,
60
                'media.media.store' => 1,
61
                'media.media.edit' => 1,
62
                'media.media.update' => 1,
63
                'media.media.destroy' => 1,
64
                'media.media-grid.index' => 1,
65
                'media.media-grid.ckIndex' => 1,
66
                /* Settings */
67
                'setting.settings.index' => 1,
68
                'setting.settings.store' => 1,
69
                'setting.settings.getModuleSettings' => 1,
70
                /* Page */
71
                'page.pages.index' => 1,
72
                'page.pages.create' => 1,
73
                'page.pages.store' => 1,
74
                'page.pages.edit' => 1,
75
                'page.pages.update' => 1,
76
                'page.pages.destroy' => 1,
77
            ],
78
        ));
79
80
        // Create an Users group
81
        Sentry::createGroup(array(
82
            'name'        => 'User',
83
            'permissions' => [
84
                'dashboard.index' => 1,
85
            ],
86
        ));
87
    }
88
}
89