Commit 3b2a9d90 by lujunyi

登录

parent fb633471
...@@ -25,8 +25,7 @@ public function login(Request $request) ...@@ -25,8 +25,7 @@ public function login(Request $request)
$user = User::firstOrCreate(['openid', $credentials['openid']]); $user = User::firstOrCreate(['openid', $credentials['openid']]);
// 追加登录类型到token里面,前端需要带在header头中 Authorization:Bearer Token // 追加登录类型到token里面,前端需要带在header头中 Authorization:Bearer Token
$token = auth('api')->claims(['login_type' => User::LOGIN_TYPE_USER])->fromUser($user); $token = auth('api')->claims(['login_type' => User::LOGIN_TYPE_USER])->fromUser($user);
// $data = $this->respondWithToken($token)->original; $data = $this->respondWithToken($token)->original;
$data = ['token' => $token];
return $this->success($data); return $this->success($data);
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment