mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-28 06:57:22 +08:00
fix UserFactory
This commit is contained in:
@@ -33,6 +33,7 @@ class UserGenerate extends Command
|
|||||||
$log = "num: $num";
|
$log = "num: $num";
|
||||||
if (!$num) {
|
if (!$num) {
|
||||||
$this->error("$log, no num!");
|
$this->error("$log, no num!");
|
||||||
|
return Command::SUCCESS;
|
||||||
}
|
}
|
||||||
$size = 1000;
|
$size = 1000;
|
||||||
$total = 0;
|
$total = 0;
|
||||||
|
|||||||
@@ -9,13 +9,8 @@ use Illuminate\Support\Str;
|
|||||||
|
|
||||||
class UserFactory extends Factory
|
class UserFactory extends Factory
|
||||||
{
|
{
|
||||||
private string $defaultStyleSheet;
|
private static string $defaultStyleSheet = "";
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
do_log("UserFactory __construct");
|
|
||||||
$this->defaultStyleSheet = get_setting("main.defstylesheet");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the factory's corresponding model.
|
* The name of the factory's corresponding model.
|
||||||
@@ -34,13 +29,16 @@ class UserFactory extends Factory
|
|||||||
$password = "123456";
|
$password = "123456";
|
||||||
$secret = mksecret();
|
$secret = mksecret();
|
||||||
$passhash = md5($secret . $password . $secret);
|
$passhash = md5($secret . $password . $secret);
|
||||||
|
if (self::$defaultStyleSheet == "") {
|
||||||
|
self::$defaultStyleSheet = get_setting("main.defstylesheet");
|
||||||
|
}
|
||||||
return [
|
return [
|
||||||
'username' => $this->faker->name,
|
'username' => $this->faker->name,
|
||||||
'email' => $this->faker->unique()->safeEmail,
|
'email' => $this->faker->unique()->safeEmail,
|
||||||
'secret' => mksecret(),
|
'secret' => mksecret(),
|
||||||
'editsecret' => "",
|
'editsecret' => "",
|
||||||
'passhash' => $passhash,
|
'passhash' => $passhash,
|
||||||
'stylesheet' => $this->defaultStyleSheet,
|
'stylesheet' => self::$defaultStyleSheet,
|
||||||
'added' => now()->toDateTimeString(),
|
'added' => now()->toDateTimeString(),
|
||||||
'status' => User::STATUS_CONFIRMED,
|
'status' => User::STATUS_CONFIRMED,
|
||||||
'class' => random_int(intval(User::CLASS_USER), intval(User::CLASS_SYSOP))
|
'class' => random_int(intval(User::CLASS_USER), intval(User::CLASS_SYSOP))
|
||||||
|
|||||||
Reference in New Issue
Block a user