Completed
Push — master ( 1087ad...2bc4d2 )
by ARCANEDEV
8s
created

SystemRoutes::map()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 9
ccs 7
cts 7
cp 1
crap 1
rs 9.6666
c 0
b 0
f 0
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 21
    public function map()
21
    {
22
        $this->namespace('System')->prefix('system')->name('system.')->group(function () {
23 21
            $this->registerSystemInformationRoutes();
24 21
            $this->registerLogViewerRoutes();
25 21
            $this->registerRouteViewerRoutes();
26 21
            $this->registerBackupsRoutes();
27 21
        });
28 21
    }
29
30
    /* ------------------------------------------------------------------------------------------------
31
     |  Other Functions
32
     | ------------------------------------------------------------------------------------------------
33
     */
34
    /**
35
     * Register the system information routes.
36
     */
37 21
    private function registerSystemInformationRoutes()
38
    {
39
        $this->prefix('information')->name('information.')->group(function () {
40 21
            $this->get('/', 'InformationController@index')
41 21
                ->name('index');  // admin::foundation.system.information.index
42 21
        });
43 21
    }
44
45
    /**
46
     * Register LogViewer routes.
47
     */
48 21
    private function registerLogViewerRoutes()
49
    {
50
        $this->prefix('log-viewer')->name('log-viewer.')->group(function () {
51 21
            $this->get('/', 'LogViewerController@index')
52 21
                ->name('index'); // admin::foundation.system.log-viewer.index
53
54
            $this->prefix('logs')->name('logs.')->group(function() {
55 21
                $this->get('/', 'LogViewerController@listLogs')
56 21
                    ->name('list'); // admin::foundation.system.log-viewer.logs.list
57
58 21
                $this->get('{date}', 'LogViewerController@show')
59 21
                    ->name('show'); // admin::foundation.system.log-viewer.logs.show
60
61 21
                $this->get('{date}/download', 'LogViewerController@download')
62 21
                    ->name('download'); // admin::foundation.system.log-viewer.logs.download
63
64 21
                $this->get('{date}/{level}', 'LogViewerController@showByLevel')
65 21
                    ->name('filter'); // admin::foundation.system.log-viewer.logs.filter
66
67 21
                $this->delete('delete', 'LogViewerController@delete')
68 21
                    ->name('delete'); // admin::foundation.system.log-viewer.logs.delete
69 21
            });
70 21
        });
71 21
    }
72
73
    /**
74
     * Register the route viewer routes.
75
     */
76 21
    private function registerRouteViewerRoutes()
77
    {
78
        $this->prefix('routes')->name('routes.')->group(function () {
79 21
            $this->get('/', 'RoutesController@index')
80 21
                ->name('index'); // admin::foundation.system.routes.index
81 21
        });
82 21
    }
83
84
    /**
85
     * Register the backups routes.
86
     */
87
    private function registerBackupsRoutes()
88
    {
89 21
        $this->prefix('backups')->name('backups.')->group(function () {
90 21
            $this->get('/', 'BackupsController@index')
91 21
                ->name('index');   // admin::foundation.system.backups.index
92
93 21
            $this->post('backup', 'BackupsController@backup')
94 21
                 ->name('backup'); // admin::foundation.system.backups.backup
95
96 21
            $this->post('clear', 'BackupsController@clear')
97 21
                 ->name('clear');  // admin::foundation.system.backups.clear
98
99 21
            $this->get('{index}', 'BackupsController@show')
100 21
                ->name('show');    // admin::foundation.system.backups.show
101 21
        });
102 21
    }
103
}
104