Merge branch 'people' of ssh://halbi.ddnss.de:2122/media/raid/repositories/pollux into people
This commit is contained in:
@@ -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')
|
||||
];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user