Completed
Push — master ( 96b827...e9016c )
by ARCANEDEV
15:51
created

PermissionsTableSeeder   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 138
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 138
rs 10

5 Methods

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