Completed
Push — master ( 6afbe3...49fc1c )
by ARCANEDEV
05:32
created

SystemRoutes::map()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 6
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 9
ccs 0
cts 8
cp 0
crap 2
rs 9.6666
1
<?php namespace Arcanesoft\Foundation\Http\Routes\Admin;
2
3
use Arcanedev\Support\Routing\RouteRegistrar;
4
5
/**
6
 * Class     SystemRoutes
7
 *
8
 * @package  Arcanesoft\Foundation\Http\Routes\Admin
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class SystemRoutes extends RouteRegistrar
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Main Functions
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Map routes.
19
     */
20
    public function map()
21
    {
22
        $this->namespace('System')->prefix('system')->name('system.')->group(function () {
23
            $this->registerSystemInformationRoutes();
24
            $this->registerLogViewerRoutes();
25
            $this->registerRouteViewerRoutes();
26
            $this->registerBackupsRoutes();
27
        });
28
    }
29
30
    /* ------------------------------------------------------------------------------------------------
31
     |  Other Functions
32
     | ------------------------------------------------------------------------------------------------
33
     */
34
    /**
35
     * Register the system information routes.
36
     */
37
    private function registerSystemInformationRoutes()
38
    {
39
        $this->prefix('information')->name('information.')->group(function () {
40
            $this->get('/', 'InformationController@index')
41
                ->name('index');  // admin::foundation.system.information.index
42
        });
43
    }
44
45
    /**
46
     * Register LogViewer routes.
47
     */
48
    private function registerLogViewerRoutes()
49
    {
50
        $this->prefix('log-viewer')->name('log-viewer.')->group(function () {
51
            $this->get('/', 'LogViewerController@index')
52
                ->name('index'); // admin::foundation.system.log-viewer.index
53
54
            $this->prefix('logs')->name('logs.')->group(function() {
55
                $this->get('/', 'LogViewerController@listLogs')
56
                    ->name('list'); // admin::foundation.system.log-viewer.logs.list
57
58
                $this->get('{date}', 'LogViewerController@show')
59
                    ->name('show'); // admin::foundation.system.log-viewer.logs.show
60
61
                $this->get('{date}/download', 'LogViewerController@download')
62
                    ->name('download'); // admin::foundation.system.log-viewer.logs.download
63
64
                $this->get('{date}/{level}', 'LogViewerController@showByLevel')
65
                    ->name('filter'); // admin::foundation.system.log-viewer.logs.filter
66
67
                $this->delete('delete', 'LogViewerController@delete')
68
                    ->name('delete'); // admin::foundation.system.log-viewer.logs.delete
69
            });
70
        });
71
    }
72
73
    /**
74
     * Register the route viewer routes.
75
     */
76
    private function registerRouteViewerRoutes()
77
    {
78
        $this->prefix('routes')->name('routes.')->group(function () {
79
            $this->get('/', 'RoutesController@index')
80
                ->name('index'); // admin::foundation.system.routes.index
81
        });
82
    }
83
84
    /**
85
     * Register the backups routes.
86
     */
87
    private function registerBackupsRoutes()
88
    {
89
        $this->prefix('backups')->name('backups.')->group(function () {
90
            $this->get('/', 'BackupsController@index')
91
                ->name('index');   // admin::foundation.system.backups.index
92
93
            $this->post('backup', 'BackupsController@backup')
94
                 ->name('backup'); // admin::foundation.system.backups.backup
95
96
            $this->post('clear', 'BackupsController@clear')
97
                 ->name('clear');  // admin::foundation.system.backups.clear
98
99
            $this->get('{index}', 'BackupsController@show')
100
                ->name('show');    // admin::foundation.system.backups.show
101
        });
102
    }
103
}
104