Skip to content

Commit 55d3d69

Browse files
committed
fix(control): 获取角色
1 parent ccb16ff commit 55d3d69

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

laravel/app/Http/Controllers/AuthController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ public function info()
7171
// return response()->json(auth('api')->user());
7272
// 输出管理员 roles
7373
$userInfo = auth('api')->user();
74+
$roles = $userInfo->roles->map(function($item) {
75+
return $item->name;
76+
});
7477
$data = [
75-
'roles' => 'admin',
78+
'roles' => $roles,
7679
'name' => $userInfo['name'],
7780
// 'avatar' => 'https://note.youdao.com/favicon.ico',
7881
'avatar' => 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',

0 commit comments

Comments
 (0)