1
|
|
|
<?php namespace Arcanesoft\Auth\Http\Routes\Admin; |
2
|
|
|
|
3
|
|
|
use Arcanedev\Support\Routing\RouteRegistrar; |
4
|
|
|
use Arcanesoft\Auth\Models\Permission; |
5
|
|
|
use Arcanesoft\Auth\Models\PermissionsGroup; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class PermissionsRoutes |
9
|
|
|
* |
10
|
|
|
* @package Arcanesoft\Auth\Http\Routes\Admin |
11
|
|
|
* @author ARCANEDEV <[email protected]> |
12
|
|
|
*/ |
13
|
|
|
class PermissionsRoutes extends RouteRegistrar |
14
|
|
|
{ |
15
|
|
|
/* ----------------------------------------------------------------- |
16
|
|
|
| Main Methods |
17
|
|
|
| ----------------------------------------------------------------- |
18
|
|
|
*/ |
19
|
|
|
/** |
20
|
|
|
* Register the bindings. |
21
|
|
|
*/ |
22
|
15 |
|
public static function bindings() |
23
|
|
|
{ |
24
|
15 |
|
$registrar = new static; |
25
|
|
|
|
26
|
15 |
|
$registrar->bind('auth_permission', function($hashedId) { |
27
|
|
|
return Permission::firstHashedOrFail($hashedId); |
28
|
15 |
|
}); |
29
|
|
|
|
30
|
15 |
|
$registrar->bind('auth_permissions_group', function($hashedId) { |
31
|
|
|
return PermissionsGroup::firstHashedOrFail($hashedId); |
32
|
15 |
|
}); |
33
|
15 |
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Map routes. |
37
|
|
|
*/ |
38
|
|
|
public function map() |
39
|
|
|
{ |
40
|
15 |
|
$this->prefix('permissions')->name('permissions.')->group(function () { |
41
|
15 |
|
$this->get('/', 'PermissionsController@index') |
42
|
15 |
|
->name('index'); // admin::auth.permissions.index |
43
|
|
|
|
44
|
15 |
|
$this->get('group/{auth_permissions_group}', 'PermissionsController@group') |
45
|
15 |
|
->name('group'); // admin::auth.permissions.group |
46
|
|
|
|
47
|
15 |
|
$this->prefix('{auth_permission}')->group(function () { |
48
|
15 |
|
$this->get('/', 'PermissionsController@show') |
49
|
15 |
|
->name('show'); // admin::auth.permissions.show |
50
|
|
|
|
51
|
15 |
|
$this->delete('roles/{auth_role}/detach', 'PermissionsController@detachRole') |
52
|
15 |
|
->middleware('ajax') |
53
|
15 |
|
->name('roles.detach'); // admin::auth.permissions.roles.detach |
54
|
15 |
|
}); |
55
|
15 |
|
}); |
56
|
15 |
|
} |
57
|
|
|
} |
58
|
|
|
|