From dee8c07bc0dec89c8154872dc7e41c761175971f Mon Sep 17 00:00:00 2001 From: kroutony Date: Sun, 23 Feb 2020 20:54:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BB=BA=E7=AB=8Beditor?= =?UTF-8?q?=E5=B8=B3=E8=99=9F=E7=9A=84=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/CreateEditorAccount.php | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 app/Console/Commands/CreateEditorAccount.php diff --git a/app/Console/Commands/CreateEditorAccount.php b/app/Console/Commands/CreateEditorAccount.php new file mode 100644 index 0000000..b289f89 --- /dev/null +++ b/app/Console/Commands/CreateEditorAccount.php @@ -0,0 +1,57 @@ +argument('email'); + $password = $this->argument('password'); + + $user = User::create([ + 'email' => $email, + 'password' => Hash::make($password), + 'api_token' => Str::random(36) + ]); + + $user->assignRole('editor'); + + $this->info("Account: $email has been created"); + } +}