update role
This commit is contained in:
@@ -38,7 +38,7 @@ class RoleController extends AbstractController
|
|||||||
#[OA\Get(
|
#[OA\Get(
|
||||||
path: '/roles',
|
path: '/roles',
|
||||||
summary: '角色列表',
|
summary: '角色列表',
|
||||||
description: '获取所有角色,包含每个角色的用户数',
|
description: '获取所有角色,包含每个角色的用户数和路由组数',
|
||||||
security: [['bearerAuth' => []]],
|
security: [['bearerAuth' => []]],
|
||||||
tags: ['Roles'],
|
tags: ['Roles'],
|
||||||
responses: [
|
responses: [
|
||||||
@@ -52,7 +52,10 @@ class RoleController extends AbstractController
|
|||||||
properties: [
|
properties: [
|
||||||
new OA\Property(property: 'id', type: 'integer', example: 1),
|
new OA\Property(property: 'id', type: 'integer', example: 1),
|
||||||
new OA\Property(property: 'name', type: 'string', example: 'editor'),
|
new OA\Property(property: 'name', type: 'string', example: 'editor'),
|
||||||
|
new OA\Property(property: 'label', type: 'string', example: '编辑者'),
|
||||||
|
new OA\Property(property: 'description', type: 'string', example: '可以编辑内容'),
|
||||||
new OA\Property(property: 'users_count', type: 'integer', example: 5),
|
new OA\Property(property: 'users_count', type: 'integer', example: 5),
|
||||||
|
new OA\Property(property: 'route_groups_count', type: 'integer', example: 3),
|
||||||
],
|
],
|
||||||
type: 'object'
|
type: 'object'
|
||||||
)),
|
)),
|
||||||
@@ -67,7 +70,7 @@ class RoleController extends AbstractController
|
|||||||
public function index(): array
|
public function index(): array
|
||||||
{
|
{
|
||||||
$roles = Role::query()
|
$roles = Role::query()
|
||||||
->withCount('users')
|
->withCount(['users', 'routeGroups'])
|
||||||
->orderBy('id')
|
->orderBy('id')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user