Completed
Push — master ( b25769...31f749 )
by ARCANEDEV
04:04
created

PermissionsTableSeeder::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 16
ccs 0
cts 16
cp 0
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
crap 2
1
<?php namespace Arcanesoft\Foundation\Seeds;
2
3
use Arcanesoft\Auth\Seeds\PermissionsSeeder;
4
5
/**
6
 * Class     PermissionTableSeeder
7
 *
8
 * @package  Arcanesoft\Foundation\Seeds
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class PermissionsTableSeeder 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'        => 'Foundation',
26
                    'slug'        => 'foundation',
27
                    'description' => 'Foundation permissions group',
28
                ],
29
                'permissions' => array_merge(
30
                    $this->getSettingsSeeds(),
31
                    $this->getLogViewerSeeds()
32
                ),
33
            ],
34
        ]);
35
    }
36
37
    /* ------------------------------------------------------------------------------------------------
38
     |  Other Functions
39
     | ------------------------------------------------------------------------------------------------
40
     */
41
    /**
42
     * Get the Settings permissions.
43
     *
44
     * @return array
45
     */
46
    private function getSettingsSeeds()
47
    {
48
        return [
49
            [
50
                'name'        => 'Settings - View the general settings',
51
                'description' => 'Allow to view the general settings.',
52
                'slug'        => 'foundation.settings.general',
53
            ]
54
        ];
55
    }
56
57
    /**
58
     * Get the LogViewer permissions.
59
     *
60
     * @return array
61
     */
62
    private function getLogViewerSeeds()
63
    {
64
        return [
65
            [
66
                'name'        => 'LogViewer - View dashboard',
67
                'description' => 'Allow to view the LogViewer dashboard.',
68
                'slug'        => 'foundation.logviewer.dashboard',
69
            ],[
70
                'name'        => 'LogViewer - List all logs',
71
                'description' => 'Allow to list all the logs.',
72
                'slug'        => 'foundation.logviewer.list',
73
            ],[
74
                'name'        => 'LogViewer - View a log',
75
                'description' => 'Allow to display a log.',
76
                'slug'        => 'foundation.logviewer.show',
77
            ],[
78
                'name'        => 'LogViewer - Download a log',
79
                'description' => 'Allow to download a log.',
80
                'slug'        => 'foundation.logviewer.download',
81
            ],[
82
                'name'        => 'LogViewer - Delete a log',
83
                'description' => 'Allow to delete a log.',
84
                'slug'        => 'foundation.logviewer.delete',
85
            ]
86
        ];
87
    }
88
}
89