https://github.com/assert6/hyperf-permission
调用权
https://github.com/assert6/hyperf-permission
hyperf
Last synced: about 1 year ago
JSON representation
调用权
- Host: GitHub
- URL: https://github.com/assert6/hyperf-permission
- Owner: assert6
- Created: 2021-06-28T07:02:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-17T03:40:08.000Z (over 2 years ago)
- Last Synced: 2025-01-23T00:42:26.469Z (about 1 year ago)
- Topics: hyperf
- Language: PHP
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 调用权
```php
class Test
{
#[Permission]
public function test()
{
return [1111];
}
}
```
```php
class TestController
{
#[Inject]
protected Test $test;
#[Authorize('App\Test::test')]
public function test()
{
// Authorization::authorize('App\Test::test');
return $this->test->test();
}
}
```
> 当调用`#[Permission]`声明的代码时, 需要`#[Authorize]`或`Authorization::authorize()`授权, 否则抛`PermissionException`