1
|
|
|
<?php namespace Arcanesoft\Auth\Http\Routes\Foundation; |
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\Foundation |
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
|
24 |
|
public function map(Registrar $router) |
26
|
|
|
{ |
27
|
24 |
|
$this->group([ |
28
|
24 |
|
'prefix' => 'permissions', |
29
|
18 |
|
'as' => 'permissions.', |
30
|
|
|
], function () { |
31
|
24 |
|
$this->get('/', [ |
32
|
24 |
|
'as' => 'index', // auth::foundation.permissions.index |
33
|
18 |
|
'uses' => 'PermissionsController@index', |
34
|
18 |
|
]); |
35
|
|
|
|
36
|
24 |
|
$this->get('group/{perms_group_id}', [ |
37
|
24 |
|
'as' => 'group', // auth::foundation.permissions.group |
38
|
18 |
|
'uses' => 'PermissionsController@group', |
39
|
18 |
|
]); |
40
|
|
|
|
41
|
24 |
|
$this->group([ |
42
|
|
|
'prefix' => '{permission_id}' |
43
|
|
|
], function () { |
44
|
24 |
|
$this->get('show', [ |
45
|
24 |
|
'as' => 'show', // auth::foundation.permissions.show |
46
|
18 |
|
'uses' => 'PermissionsController@show', |
47
|
18 |
|
]); |
48
|
|
|
|
49
|
24 |
|
$this->delete('roles/{role_id}/detach', [ |
50
|
24 |
|
'as' => 'roles.detach', // auth::foundation.permissions.roles.detach |
51
|
18 |
|
'uses' => 'PermissionsController@detachRole', |
52
|
18 |
|
]); |
53
|
24 |
|
}); |
54
|
24 |
|
}); |
55
|
|
|
|
56
|
|
|
$this->bind('permission_id', function($hashedId) { |
|
|
|
|
57
|
|
|
return Permission::firstHashedOrFail($hashedId); |
58
|
24 |
|
}); |
59
|
|
|
|
60
|
24 |
|
$this->bind('perms_group_id', function($hashedId) { |
|
|
|
|
61
|
|
|
if (head(hasher()->decode($hashedId)) === 0) { |
62
|
|
|
return null; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
return PermissionsGroup::firstHashedOrFail($hashedId); |
66
|
24 |
|
}); |
67
|
24 |
|
} |
68
|
|
|
} |
69
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.