Skip to content

Commit

Permalink
Improved faker
Browse files Browse the repository at this point in the history
  • Loading branch information
bochoven committed May 10, 2020
1 parent 8e4e255 commit c252356
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions machine_factory.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(Machine_model::class, function (Faker\Generator $faker) {
$computerName = $faker->unique()->word;
$machines = [
['iMac', 'iMac9,1', 'iMac (20-inch, Mid 2009)'],
['Macmini', 'Macmini7,1', 'Mac mini (Late 2014)'],
['Macmini', 'Macmini5,1', 'Mac mini (Mid 2011)'],
['MacBook', 'MacBookPro12,1', 'MacBook Pro (Retina, 13-inch, Early 2015)'],
['MacBook', 'MacBookPro8,1', 'MacBook Pro (13-inch, Late 2011)'],
['MacBook', 'MacBookPro9,2', 'MacBook Pro (13-inch, Mid 2012)'],
['MacBook Pro', 'MacBookPro12,1', 'MacBook Pro (Retina, 13-inch, Early 2015)'],
['MacBook Pro', 'MacBookPro8,1', 'MacBook Pro (13-inch, Late 2011)'],
['MacBook Pro', 'MacBookPro9,2', 'MacBook Pro (13-inch, Mid 2012)'],
['Macmini', 'Macmini6,2', 'Mac mini (Late 2012)'],
['MacBook', 'MacBook7,1', 'MacBook (13-inch, Mid 2010)'],
['iMac', 'iMac14,2', 'iMac (27-inch, Late 2013)'],
Expand All @@ -21,11 +20,14 @@
$oses = [
['101206', '16G29'],
['101301', '17B48'],
['101503', '19D76'],
];

list($machine_name, $machine_model, $machine_desc) = $faker->randomElement($machines);
list($os_version, $build) = $faker->randomElement($oses);

$computerName = $faker->firstName() . '\'s ' . $machine_name;

return [
'hostname' => $computerName . '.local',
'machine_model' => $machine_model,
Expand Down

0 comments on commit c252356

Please sign in to comment.