Completed
Push — master ( 8d2fdf...2555d1 )
by ARCANEDEV
14:00
created

PermissionsTableSeeder   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 175
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 175
rs 10
c 1
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 19 1
A getDashboardSeeds() 0 10 1
B getPagesSeeds() 0 30 1
B getFootersSeeds() 0 30 1
A getMetasSeeds() 0 10 1
B getRedirectsSeeds() 0 30 1
1
<?php namespace Arcanesoft\Seo\Seeds;
2
3
use Arcanesoft\Auth\Seeds\PermissionsSeeder;
4
use Arcanesoft\Seo\Policies\FootersPolicy;
5
use Arcanesoft\Seo\Policies\DashboardPolicy;
6
use Arcanesoft\Seo\Policies\MetasPolicy;
7
use Arcanesoft\Seo\Policies\PagesPolicy;
8
use Arcanesoft\Seo\Policies\RedirectsPolicy;
9
10
/**
11
 * Class     PermissionsTableSeeder
12
 *
13
 * @package  Arcanesoft\Seo\Seeds
14
 * @author   ARCANEDEV <[email protected]>
15
 */
16
class PermissionsTableSeeder extends PermissionsSeeder
17
{
18
    /* -----------------------------------------------------------------
19
     |  Main Methods
20
     | -----------------------------------------------------------------
21
     */
22
23
    /**
24
     * Run the database seeds.
25
     */
26
    public function run()
27
    {
28
        $this->seed([
29
            [
30
                'group'       => [
31
                    'name'        => 'SEO',
32
                    'slug'        => 'seo',
33
                    'description' => 'SEO permissions group',
34
                ],
35
                'permissions' => array_merge(
36
                    $this->getDashboardSeeds(),
37
                    $this->getPagesSeeds(),
38
                    $this->getFootersSeeds(),
39
                    $this->getMetasSeeds(),
40
                    $this->getRedirectsSeeds()
41
                ),
42
            ],
43
        ]);
44
    }
45
46
    /* -----------------------------------------------------------------
47
     |  Other Methods
48
     | -----------------------------------------------------------------
49
     */
50
51
    /**
52
     * Get the dashboard permissions
53
     *
54
     * @return array
55
     */
56
    private function getDashboardSeeds()
57
    {
58
        return [
59
            [
60
                'name'        => 'Statistics - Show all the stats',
61
                'description' => 'Show all the SEO stats.',
62
                'slug'        => DashboardPolicy::PERMISSION_STATS,
63
            ],
64
        ];
65
    }
66
67
    /**
68
     * Get the Pages permissions.
69
     *
70
     * @return array
71
     */
72
    private function getPagesSeeds()
73
    {
74
        return [
75
            [
76
                'name'        => 'Pages - List all pages',
77
                'description' => 'Allow to list all pages.',
78
                'slug'        => PagesPolicy::PERMISSION_LIST,
79
            ],
80
            [
81
                'name'        => 'Pages - View a page',
82
                'description' => 'Allow to display a page.',
83
                'slug'        => PagesPolicy::PERMISSION_SHOW,
84
            ],
85
            [
86
                'name'        => 'Pages - Create a page',
87
                'description' => 'Allow to create a page.',
88
                'slug'        => PagesPolicy::PERMISSION_CREATE,
89
            ],
90
            [
91
                'name'        => 'Pages - Update a page',
92
                'description' => 'Allow to update a page.',
93
                'slug'        => PagesPolicy::PERMISSION_UPDATE,
94
            ],
95
            [
96
                'name'        => 'Pages - Delete a page',
97
                'description' => 'Allow to delete a page.',
98
                'slug'        => PagesPolicy::PERMISSION_DELETE,
99
            ],
100
        ];
101
    }
102
103
    /**
104
     * Get the Footers permissions.
105
     *
106
     * @return array
107
     */
108
    private function getFootersSeeds()
109
    {
110
        return [
111
            [
112
                'name'        => 'Footers - List all footers',
113
                'description' => 'Allow to list all footers.',
114
                'slug'        => FootersPolicy::PERMISSION_LIST,
115
            ],
116
            [
117
                'name'        => 'Footers - View a footer',
118
                'description' => 'Allow to display a footer.',
119
                'slug'        => FootersPolicy::PERMISSION_SHOW,
120
            ],
121
            [
122
                'name'        => 'Footers - Create a footer',
123
                'description' => 'Allow to create a footer.',
124
                'slug'        => FootersPolicy::PERMISSION_CREATE,
125
            ],
126
            [
127
                'name'        => 'Footers - Update a footer',
128
                'description' => 'Allow to update a footer.',
129
                'slug'        => FootersPolicy::PERMISSION_UPDATE,
130
            ],
131
            [
132
                'name'        => 'Footers - Delete a footer',
133
                'description' => 'Allow to delete a footer.',
134
                'slug'        => FootersPolicy::PERMISSION_DELETE,
135
            ],
136
        ];
137
    }
138
139
    /**
140
     * Get the Metas permissions.
141
     *
142
     * @return array
143
     */
144
    private function getMetasSeeds()
145
    {
146
        return [
147
            [
148
                'name'        => 'Metas - List a metas',
149
                'description' => 'Allow to list all metas.',
150
                'slug'        => MetasPolicy::PERMISSION_LIST,
151
            ],
152
        ];
153
    }
154
155
    /**
156
     * Get the Redirects permissions.
157
     *
158
     * @return array
159
     */
160
    private function getRedirectsSeeds()
161
    {
162
        return [
163
            [
164
                'name'        => 'Redirects - List all redirections',
165
                'description' => 'Allow to list all redirections.',
166
                'slug'        => RedirectsPolicy::PERMISSION_LIST,
167
            ],
168
            [
169
                'name'        => 'Redirects - View a redirection',
170
                'description' => 'Allow to display a redirection.',
171
                'slug'        => RedirectsPolicy::PERMISSION_SHOW,
172
            ],
173
            [
174
                'name'        => 'Redirects - Create a redirection',
175
                'description' => 'Allow to create a redirection.',
176
                'slug'        => RedirectsPolicy::PERMISSION_CREATE,
177
            ],
178
            [
179
                'name'        => 'Redirects - Update a redirection',
180
                'description' => 'Allow to update a redirection.',
181
                'slug'        => RedirectsPolicy::PERMISSION_UPDATE,
182
            ],
183
            [
184
                'name'        => 'Redirects - Delete a redirection',
185
                'description' => 'Allow to delete a redirection.',
186
                'slug'        => RedirectsPolicy::PERMISSION_DELETE,
187
            ],
188
        ];
189
    }
190
}
191