Skip to content

Commit 854e8a7

Browse files
authored
Update README.md
1 parent 02da0d7 commit 854e8a7

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,18 @@ CREATE TABLE `user_role_access` (
224224
PRIMARY KEY (`user_id`,`role_id`)
225225
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
226226
```
227+
228+
### 中间件
229+
230+
角色中间件
231+
```php
232+
#route/app.php
233+
234+
use xiaodi\Permission\Middleware\Role;
235+
236+
# 拥有 edit角色的用户 可以访问此路由
237+
Route::rule('/testRole', function(){
238+
return 'edit';
239+
}, 'GET')->allowCrossDomain()->middleware(Role::class, 'Edit');
240+
241+
```

0 commit comments

Comments
 (0)