Completed
Push — master ( 7328ed...c4af57 )
by ARCANEDEV
04:44
created

RolesRoutes::map()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 32
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 23
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 23
cts 23
cp 1
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 21
nc 1
nop 0
crap 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