Merge branch 'people' of ssh://halbi.ddnss.de:2122/media/raid/repositories/pollux into people

This commit is contained in:
goldnead
2018-09-12 11:29:43 +02:00
2 changed files with 25 additions and 36 deletions
+22 -35
View File
@@ -4,49 +4,36 @@ use Faker\Generator as Faker;
use Carbon\Carbon;
$factory->define(App\Person::class, function (Faker $faker) {
$title = null;
$name_or_company = null;
$surname = null;
$date_of_birth = null;
// Decide randomly, if we create a person or a company and fill the
// differing fields accordingly
$probComp = 0.3;
$rand = $faker->numberBetween(0, $max = 1000);
if ($rand <= (int) ($probComp * $max)) {
$title = 'Firma';
$name_or_company = $faker->company;
} else {
$probMale = 0.5;
$rand = $faker->numberBetween(0, $max = 1000);
if ($rand <= (int) ($probComp * $max)) {
$title = 'Herr';
$surname = $faker->firstName('male');
} else {
$title = 'Frau';
$surname = $faker->firstName('female');
}
$name_or_company = $faker->lastName;
$date_of_birth = $faker->dateTimeInInterval($startDate = '-35 years',
$interval = '+15 years');
}
return [
'title' => $title,
'name_or_company' => $name_or_company,
'surname' => $surname,
'title' => 'Firma',
'name_or_company' => $faker->company,
'street' => $faker->streetName . ' ' . $faker->buildingNumber,
'postal_code' => $faker->randomNumber(5, true),
'city' => $faker->city,
'email' => $faker->safeEmail,
'phone' => $faker->numerify('0### / ## ## ## ##'),
'mobile' => $faker->numerify('0### / ## ## ## ##'),
'date_of_birth' => $faker->dateTimeInInterval($startDate = '-35 years',
$interval = '+15 years'),
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s')
];
});
$factory->state(App\Person::class, 'male', function ($faker) {
return [
'title' => 'Herr',
'name_or_company' => $faker->lastName,
'surname' => $faker->firstName('male'),
'date_of_birth' => $faker->dateTimeInInterval($startDate = '-35 years',
$interval = '+15 years')
];
});
$factory->state(App\Person::class, 'female', function ($faker) {
return [
'title' => 'Frau',
'name_or_company' => $faker->lastName,
'surname' => $faker->firstName('female'),
'date_of_birth' => $faker->dateTimeInInterval($startDate = '-35 years',
$interval = '+15 years')
];
});