RolesRoutes::map()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 32

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