Files
ProxyPanel/app/Console/Commands/upgradeUserPassword.php
兔姬桑 a0922521cf 初始化
2020-08-05 03:19:28 +08:00

34 lines
1.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Console\Commands;
use App\Http\Models\User;
use Illuminate\Console\Command;
use Hash;
use Log;
class upgradeUserPassword extends Command
{
protected $signature = 'upgradeUserPassword';
protected $description = '用户密码升级(MD5->HASH)';
public function __construct()
{
parent::__construct();
}
public function handle()
{
Log::info('----------------------------【升级用户登录密码】开始----------------------------');
// 将用户的登录密码由原有的md5升级为hash统一升级为与用户名相同的密码
$userList = User::query()->get();
foreach ($userList as $user) {
User::query()->where('id', $user->id)->update(['password' => Hash::make($user->username)]);
Log::info('----------------------------升级用户[' . $user->username . ']的登录密码----------------------------');
}
Log::info('----------------------------【升级用户登录密码】结束----------------------------');
}
}