From d651b7250b8e58e2c93d7b8684b9c910b0bd7b6f Mon Sep 17 00:00:00 2001 From: fthvgb1 Date: Sun, 10 Jun 2018 15:23:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E7=94=9F=E6=88=90token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/GenerateToken.php | 49 ++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 app/Console/Commands/GenerateToken.php diff --git a/app/Console/Commands/GenerateToken.php b/app/Console/Commands/GenerateToken.php new file mode 100644 index 0000000..05fdf84 --- /dev/null +++ b/app/Console/Commands/GenerateToken.php @@ -0,0 +1,49 @@ +ask('输入用户id'); + $user = User::find($userId); + if (!$user) { + return $this->error('用户不存在'); + } + $ttl = 365 * 24 * 60; + $this->info(\Auth::guard('api')->setTTL($ttl)->fromUser($user)); + } +}