Completed
Pull Request — master (#21)
by ARCANEDEV
05:07
created

RolesRoutes::map()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 24
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 36
ccs 24
cts 25
cp 0.96
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 23
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
     * Map routes.
20
     */
21 12
    public function map()
22
    {
23
        $this->bind('auth_role', function($hashedId) {
24
            return Role::firstHashedOrFail($hashedId);
25 12
        });
26
27
        $this->prefix('roles')->name('roles.')->group(function () {
28 12
            $this->get('/', 'RolesController@index')
29 12
                 ->name('index'); // admin::auth.roles.index
30
31 12
            $this->get('create', 'RolesController@create')
32 12
                 ->name('create'); // admin::auth.roles.create
33
34 12
            $this->post('store', 'RolesController@store')
35 12
                 ->name('store'); // admin::auth.roles.store
36
37 12
            $this->prefix('{auth_role}')->group(function () {
38 12
                $this->get('/', 'RolesController@show')
39 12
                     ->name('show'); // admin::auth.roles.show
40
41 12
                $this->get('edit', 'RolesController@edit')
42 12
                     ->name('edit'); // admin::auth.roles.edit
43
44 12
                $this->put('update', 'RolesController@update')
45 12
                     ->name('update'); // admin::auth.roles.update
46
47 12
                $this->middleware('ajax')
48 12
                     ->put('activate', 'RolesController@activate')
49 12
                     ->name('activate'); // admin::auth.roles.activate
50
51 12
                $this->middleware('ajax')
52 12
                     ->delete('delete', 'RolesController@delete')
53 12
                     ->name('delete'); // admin::auth.roles.delete
54 12
            });
55 12
        });
56 12
    }
57
}
58