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