Completed
Push — master ( 9539c9...6ce7ae )
by ARCANEDEV
12s
created

RolesRoutes::bindings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1.0046

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
ccs 5
cts 6
cp 0.8333
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 1.0046
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 10
    public static function bindings()
22
    {
23 10
        $registrar = new static;
24
25 10
        $registrar->bind('auth_role', function($hashedId) {
26
            return Role::firstHashedOrFail($hashedId);
27 10
        });
28 10
    }
29
30
    /**
31
     * Map routes.
32
     */
33
    public function map()
34
    {
35 10
        $this->prefix('roles')->name('roles.')->group(function () {
36 10
            $this->get('/', 'RolesController@index')
37 10
                 ->name('index'); // admin::auth.roles.index
38
39 10
            $this->get('create', 'RolesController@create')
40 10
                 ->name('create'); // admin::auth.roles.create
41
42 10
            $this->post('store', 'RolesController@store')
43 10
                 ->name('store'); // admin::auth.roles.store
44
45 10
            $this->prefix('{auth_role}')->group(function () {
46 10
                $this->get('/', 'RolesController@show')
47 10
                     ->name('show'); // admin::auth.roles.show
48
49 10
                $this->get('edit', 'RolesController@edit')
50 10
                     ->name('edit'); // admin::auth.roles.edit
51
52 10
                $this->put('update', 'RolesController@update')
53 10
                     ->name('update'); // admin::auth.roles.update
54
55 10
                $this->put('activate', 'RolesController@activate')
56 10
                     ->middleware('ajax')
57 10
                     ->name('activate'); // admin::auth.roles.activate
58
59 10
                $this->delete('delete', 'RolesController@delete')
60 10
                     ->middleware('ajax')
61 10
                     ->name('delete'); // admin::auth.roles.delete
62 10
            });
63
        });
64
    }
65
}
66