We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c51d3f commit 3f3d225Copy full SHA for 3f3d225
laravel/app/Models/ApiExcel.php
@@ -33,4 +33,28 @@ public function apiParam()
33
{
34
return $this->belongsTo(ApiParam::class, 'api_param_id');
35
}
36
+
37
+ /**
38
+ * 访问器--访问用户名
39
+ *
40
+ * @param $uid
41
42
+ * @return mixed|string
43
+ */
44
+ public function getUidAttribute($uid)
45
+ {
46
+ $user = \App\User::where('id', $uid)->first(['name']);
47
+ return $user->name ?? '';
48
+ }
49
50
51
+ * 修改器--修改为用户 id
52
53
54
55
+ public function setUidAttribute($uid)
56
57
+ // 根据 jwt 查询用户 ID
58
+ $this->attributes['uid'] = auth('api')->user()['id'];
59
60
0 commit comments