1
|
|
|
<?php namespace Arcanesoft\Auth\Http\Routes\Admin; |
2
|
|
|
|
3
|
|
|
use Arcanedev\Support\Bases\RouteRegister; |
4
|
|
|
use Arcanesoft\Auth\Models\Permission; |
5
|
|
|
use Arcanesoft\Auth\Models\PermissionsGroup; |
6
|
|
|
use Illuminate\Contracts\Routing\Registrar; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class PermissionsRoutes |
10
|
|
|
* |
11
|
|
|
* @package Arcanesoft\Auth\Http\Routes\Admin |
12
|
|
|
* @author ARCANEDEV <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
class PermissionsRoutes 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_permission', function($hashedId) { |
28
|
|
|
return Permission::firstHashedOrFail($hashedId); |
29
|
12 |
|
}); |
30
|
|
|
|
31
|
|
|
$this->bind('auth_permissions_group', function($hashedId) { |
32
|
|
|
return PermissionsGroup::firstHashedOrFail($hashedId); |
33
|
12 |
|
}); |
34
|
|
|
|
35
|
|
|
$this->group(['prefix' => 'permissions', 'as' => 'permissions.'], function () { |
36
|
12 |
|
$this->get('/', 'PermissionsController@index') |
37
|
12 |
|
->name('index'); // admin::auth.permissions.index |
38
|
|
|
|
39
|
12 |
|
$this->get('group/{auth_permissions_group}', 'PermissionsController@group') |
40
|
12 |
|
->name('group'); // admin::auth.permissions.group |
41
|
|
|
|
42
|
12 |
|
$this->group(['prefix' => '{auth_permission}'], function () { |
43
|
12 |
|
$this->get('/', 'PermissionsController@show') |
44
|
12 |
|
->name('show'); // admin::auth.permissions.show |
45
|
|
|
|
46
|
12 |
|
$this->delete('roles/{auth_role}/detach', 'PermissionsController@detachRole') |
47
|
12 |
|
->name('roles.detach'); // admin::auth.permissions.roles.detach |
48
|
12 |
|
}); |
49
|
12 |
|
}); |
50
|
12 |
|
} |
51
|
|
|
} |
52
|
|
|
|