Completed
Push — master ( 3c7575...f2d5fe )
by ARCANEDEV
03:22
created

RolesRoutes   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 96.43%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 54
ccs 27
cts 28
cp 0.9643
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bindings() 0 8 1
B map() 0 32 1
1
<?php namespace Arcanesoft\Auth\Http\Routes\Admin;
2
3
use Arcanedev\Support\Routing\RouteRegistrar;
4
use Arcanesoft\Auth\Models\Role;
5
6
/**
7
 * Class     RolesRoutes
8
 *
9
 * @package  Arcanesoft\Auth\Http\Routes\Admin
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class RolesRoutes extends RouteRegistrar
13
{
14
    /* -----------------------------------------------------------------
15
     |  Main Methods
16
     | -----------------------------------------------------------------
17
     */
18
    /**
19
     * Register the bindings.
20
     */
21 12
    public static function bindings()
22
    {
23 12
        $registrar = new static;
24
25
        $registrar->bind('auth_role', function($hashedId) {
26
            return Role::firstHashedOrFail($hashedId);
27 12
        });
28 12
    }
29
30
    /**
31
     * Map routes.
32
     */
33 12
    public function map()
34
    {
35
        $this->prefix('roles')->name('roles.')->group(function () {
36 12
            $this->get('/', 'RolesController@index')
37 12
                 ->name('index'); // admin::auth.roles.index
38
39 12
            $this->get('create', 'RolesController@create')
40 12
                 ->name('create'); // admin::auth.roles.create
41
42 12
            $this->post('store', 'RolesController@store')
43 12
                 ->name('store'); // admin::auth.roles.store
44
45 12
            $this->prefix('{auth_role}')->group(function () {
46 12
                $this->get('/', 'RolesController@show')
47 12
                     ->name('show'); // admin::auth.roles.show
48
49 12
                $this->get('edit', 'RolesController@edit')
50 12
                     ->name('edit'); // admin::auth.roles.edit
51
52 12
                $this->put('update', 'RolesController@update')
53 12
                     ->name('update'); // admin::auth.roles.update
54
55 12
                $this->put('activate', 'RolesController@activate')
56 12
                     ->middleware('ajax')
57 12
                     ->name('activate'); // admin::auth.roles.activate
58
59 12
                $this->delete('delete', 'RolesController@delete')
60 12
                     ->middleware('ajax')
61 12
                     ->name('delete'); // admin::auth.roles.delete
62 12
            });
63 12
        });
64 12
    }
65
}
66