-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmachine_factory.php
45 lines (39 loc) · 1.78 KB
/
machine_factory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(Machine_model::class, function (Faker\Generator $faker) {
$oses = [
['101206', '16G29'],
['101301', '17B48'],
['101503', '19D76'],
];
// Allow standalone
try {
list($modelcode, $machine_name, $machine_model, $machine_desc) = FakerDataStore::get('machine_factory', 'machine');
} catch (\Throwable $th) {
list($modelcode, $machine_name, $machine_model, $machine_desc) = ['P7QM', 'MacPro', 'MacPro7,1', 'Mac Pro (2019)'];
}
list($os_version, $build) = $faker->randomElement($oses);
$computerName = $faker->firstName() . '\'s ' . $machine_name;
return [
'serial_number' => $faker->unique()->regexify('[A-Z0-9]{3}[CDFGHJKLMNPQRSTVWXYZ][123456789CDFGHJKLMNPQRTVWXY][A-Z0-9]{3}P7QM'),
'hostname' => $faker->domainWord() . '.local',
'machine_model' => $machine_model,
'machine_desc' => $machine_desc,
'img_url' => '',
'cpu' => $faker->text,
'current_processor_speed' => $faker->randomFloat(2, 1, 4) . " GHz",
'cpu_arch' => 'x86_64',
'os_version' => $os_version,
'physical_memory' => $faker->randomElement([4,8,16,32]),
'platform_uuid' => $faker->uuid,
'number_processors' => $faker->randomElement([2,4,6,8]),
'SMC_version_system' => $faker->randomFloat(2, 1, 3) . 'f' . $faker->randomDigit,
'boot_rom_version' => $faker->regexify('[IMBP]{2}\.[0-9]{4}\.[A-Z]+'),
'bus_speed' => $faker->randomElement([null, '1.07 Ghz']),
'computer_name' => $computerName,
'l2_cache' => $faker->randomElement([null, '3 MB', '6 MB']),
'machine_name' => $machine_name,
'packages' => 1,
'buildversion' => $build,
];
});