Completed
Push — master ( be6ba3...e40024 )
by ARCANEDEV
33:28
created

PermissionTableSeeder::getOtherSeeds()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 0
cts 10
cp 0
rs 9.4286
cc 1
eloc 5
nc 1
nop 0
crap 2
1
<?php namespace Arcanesoft\Auth\Seeds\Foundation;
2
3
use Arcanesoft\Auth\Seeds\PermissionsSeeder;
4
5
/**
6
 * Class     PermissionTableSeeder
7
 *
8
 * @package  Arcanesoft\Auth\Seeds\Foundation
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class PermissionTableSeeder extends PermissionsSeeder
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Main Functions
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Run the database seeds.
19
     */
20
    public function run()
21
    {
22
        $this->seed([
23
            [
24
                'group'       => [
25
                    'name'        => 'Auth',
26
                    'slug'        => 'auth',
27
                    'description' => 'Auth permissions group',
28
                ],
29
                'permissions' => array_merge(
30
                    $this->getUsersSeeds(),
31
                    $this->getRolesSeeds(),
32
                    $this->getPermissionsSeeds(),
33
                    $this->getOtherSeeds()
34
                ),
35
            ],
36
        ]);
37
    }
38
39
    /* ------------------------------------------------------------------------------------------------
40
     |  Other Functions
41
     | ------------------------------------------------------------------------------------------------
42
     */
43
    /**
44
     * Get user's permissions seeds.
45
     *
46
     * @return array
47
     */
48
    private function getUsersSeeds()
49
    {
50
        return [
51
            [
52
                'name'        => 'Users - List all users',
53
                'description' => 'Allow to list all users.',
54
                'slug'        => 'auth.users.list',
55
            ],[
56
                'name'        => 'Users - View a user',
57
                'description' => 'Allow to view a user\'s details.',
58
                'slug'        => 'auth.users.show',
59
            ],[
60
                'name'        => 'Users - Add/Create a user',
61
                'description' => 'Allow to create a new user.',
62
                'slug'        => 'auth.users.create',
63
            ],[
64
                'name'        => 'Users - Edit/Update a user',
65
                'description' => 'Allow to update a user.',
66
                'slug'        => 'auth.users.update',
67
            ],[
68
                'name'        => 'Users - Delete a user',
69
                'description' => 'Allow to delete a user.',
70
                'slug'        => 'auth.users.delete',
71
            ],
72
        ];
73
    }
74
75
    /**
76
     * Get role's permissions seeds.
77
     *
78
     * @return array
79
     */
80
    private function getRolesSeeds()
81
    {
82
        return [
83
            [
84
                'name'        => 'Roles - List all roles',
85
                'description' => 'Allow to list all roles.',
86
                'slug'        => 'auth.roles.list',
87
            ],[
88
                'name'        => 'Roles - View a role',
89
                'description' => 'Allow to view the role\'s details.',
90
                'slug'        => 'auth.roles.show',
91
            ],[
92
                'name'        => 'Roles - Add/Create a role',
93
                'description' => 'Allow to create a new role.',
94
                'slug'        => 'auth.roles.create',
95
            ],[
96
                'name'        => 'Roles - Edit/Update a role',
97
                'description' => 'Allow to update a role.',
98
                'slug'        => 'auth.roles.update',
99
            ],[
100
                'name'        => 'Roles - Delete a role',
101
                'description' => 'Allow to delete a role.',
102
                'slug'        => 'auth.roles.delete',
103
            ],
104
        ];
105
    }
106
107
    /**
108
     * Get permissions's permissions seeds. (** Inception **)
109
     *
110
     * @return array
111
     */
112
    private function getPermissionsSeeds()
113
    {
114
        return [
115
            [
116
                'name'        => 'Permissions - List all permissions',
117
                'description' => 'Allow to list all permissions.',
118
                'slug'        => 'auth.permissions.list',
119
            ],[
120
                'name'        => 'Permissions - View a permission',
121
                'description' => 'Allow to view the permission\'s details.',
122
                'slug'        => 'auth.permissions.show',
123
            ],[
124
                'name'        => 'Permissions - Update a permission',
125
                'description' => 'Allow to update a permission.',
126
                'slug'        => 'auth.permissions.update',
127
            ],
128
        ];
129
    }
130
131
    /**
132
     * Get the other permissions seeds for auth module.
133
     *
134
     * @return array
135
     */
136
    private function getOtherSeeds()
137
    {
138
        return [
139
            [
140
                'name'        => 'Dashboard - View the dashboard stats',
141
                'description' => 'Allow to view a auth stats.',
142
                'slug'        => 'auth.dashboard.stats',
143
            ]
144
        ];
145
    }
146
}
147