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
|
|
|
* Register the bindings. |
21
|
|
|
*/ |
22
|
12 |
|
public static function bindings() |
23
|
|
|
{ |
24
|
12 |
|
$registrar = new static; |
25
|
|
|
|
26
|
|
|
$registrar->bind('auth_user', function($hashedId) { |
27
|
|
|
return User::firstHashedOrFail($hashedId); |
28
|
12 |
|
}); |
29
|
12 |
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Map routes. |
33
|
|
|
*/ |
34
|
12 |
|
public function map() |
35
|
|
|
{ |
36
|
|
|
$this->prefix('users')->name('users.')->group(function () { |
37
|
12 |
|
$this->get('/', 'UsersController@index') |
38
|
12 |
|
->name('index'); // admin::auth.users.index |
39
|
|
|
|
40
|
12 |
|
$this->get('trash', 'UsersController@trashList') |
41
|
12 |
|
->name('trash'); // admin::auth.users.trash |
42
|
|
|
|
43
|
12 |
|
$this->get('roles-filter/{auth_role}', 'UsersController@listByRole') |
44
|
12 |
|
->name('roles-filter.index'); // admin::auth.users.roles-filter.index |
45
|
|
|
|
46
|
12 |
|
$this->get('create', 'UsersController@create') |
47
|
12 |
|
->name('create'); // admin::auth.users.create |
48
|
|
|
|
49
|
12 |
|
$this->post('store', 'UsersController@store') |
50
|
12 |
|
->name('store'); // admin::auth.users.store |
51
|
|
|
|
52
|
12 |
|
$this->prefix('{auth_user}')->group(function () { |
53
|
12 |
|
$this->get('/', 'UsersController@show') |
54
|
12 |
|
->name('show'); // admin::auth.users.show |
55
|
|
|
|
56
|
12 |
|
$this->get('edit', 'UsersController@edit') |
57
|
12 |
|
->name('edit'); // admin::auth.users.edit |
58
|
|
|
|
59
|
12 |
|
$this->put('update', 'UsersController@update') |
60
|
12 |
|
->name('update'); // admin::auth.users.update |
61
|
|
|
|
62
|
12 |
|
$this->put('activate', 'UsersController@activate') |
63
|
12 |
|
->middleware('ajax') |
64
|
12 |
|
->name('activate'); // admin::auth.users.activate |
65
|
|
|
|
66
|
12 |
|
$this->put('restore', 'UsersController@restore') |
67
|
12 |
|
->middleware('ajax') |
68
|
12 |
|
->name('restore'); // admin::auth.users.restore |
69
|
|
|
|
70
|
12 |
|
$this->delete('delete', 'UsersController@delete') |
71
|
12 |
|
->middleware('ajax') |
72
|
12 |
|
->name('delete'); // admin::auth.users.delete |
73
|
|
|
|
74
|
12 |
|
if (UserImpersonator::isEnabled()) { |
75
|
|
|
$this->get('impersonate', 'UsersController@impersonate') |
76
|
|
|
->name('impersonate'); // admin::auth.users.impersonate |
77
|
|
|
} |
78
|
12 |
|
}); |
79
|
12 |
|
}); |
80
|
12 |
|
} |
81
|
|
|
} |
82
|
|
|
|