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

UsersRoutes   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 88.89%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 61
ccs 32
cts 36
cp 0.8889
rs 10
c 2
b 0
f 0

1 Method

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