SystemRoutes::map()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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