Various fixes for DB seeding
This commit is contained in:
@@ -26,7 +26,31 @@ public function definition()
|
||||
$hasMatrix = rand(0, 9) >= 7;
|
||||
$hasGithub = rand(0, 9) >= 7;
|
||||
|
||||
$contact = [
|
||||
$onlineAccounts = [];
|
||||
|
||||
if ($hasLinkedIn) {
|
||||
$onlineAccounts[] = [
|
||||
'platform' => 'linkedin',
|
||||
'user_name' => $userName,
|
||||
'url' => 'https://www.linkedin.com/in/' . $userName
|
||||
];
|
||||
}
|
||||
if ($hasMatrix) {
|
||||
$onlineAccounts[] = [
|
||||
'platform' => 'matrix',
|
||||
'user_name' => $userName,
|
||||
'url' => '@' . $userName . ':matrix.org'
|
||||
];
|
||||
}
|
||||
if ($hasGithub) {
|
||||
$onlineAccounts[] = [
|
||||
'platform' => 'github',
|
||||
'user_name' => $userName,
|
||||
'url' => 'https://www.github.com/' . $userName
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'is_primary' => $this->faker->boolean(30),
|
||||
'salutation' => $this->faker->title($gender),
|
||||
'first_name' => $this->faker->firstName($gender),
|
||||
@@ -36,25 +60,7 @@ public function definition()
|
||||
'phone' => $this->faker->phoneNumber(),
|
||||
'mobile_phone' => $this->faker->phoneNumber(),
|
||||
'avatar' => $avatar,
|
||||
'online_accounts' => []
|
||||
'online_accounts' => $onlineAccounts
|
||||
];
|
||||
|
||||
if ($hasLinkedIn) $contact[] = [
|
||||
'platform' => 'linkedin',
|
||||
'user_name' => $userName,
|
||||
'url' => 'https://www.linkedin.com/in/' . $userName
|
||||
];
|
||||
if ($hasMatrix) $contact[] = [
|
||||
'platform' => 'matrix',
|
||||
'user_name' => $userName,
|
||||
'url' => '@' . $userName . ':matrix.org'
|
||||
];
|
||||
if ($hasGithub) $contact[] = [
|
||||
'platform' => 'github',
|
||||
'user_name' => $userName,
|
||||
'url' => 'https://www.github.com/' . $userName
|
||||
];
|
||||
|
||||
return $contact;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user