Skip to content

Commit

Permalink
Add factory
Browse files Browse the repository at this point in the history
  • Loading branch information
bochoven committed May 13, 2020
1 parent e115834 commit 1c45571
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions managedinstalls_factory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(Managedinstalls_model::class, function (Faker\Generator $faker) {

$type = $faker->randomElement(['munki', 'applesus']);

switch ($type) {
case 'munki':
$installs = [
["chrome", "Google Chrome"],
["firefox", "Firefox"],
["bcm", "Bitcoin Miner 2000"],
["spotify", "Spotify"],
["slack", "Slack"],
["finalcutpro", "Final Cut Pro"],
["discord", "Discord"],
];
break;
default:
$installs = [
["jkhsdf-111", "Security update"],
["jkhsdf-343", "Security update"],
["jkhsdf-332", "Supplemental update"],
["jkhsdf-445", "Supplemental supplemental update"],
];
break;
}

list($name, $display_name) = $faker->randomElement($installs);

return [
'name' => $name,
'display_name' => $display_name,
'version' => $faker->randomElement(['10.12.3', '9.3.1', '4.5.12', '10.1.1']) ,
'size' => $faker->numberBetween(1000000, 10000000),
'installed' => $faker->numberBetween(1000000, 10000000),
'status' => $faker->randomElement(['install_failed', 'install_succeeded', 'installed', 'pending_install', 'pending_removal', 'removed', 'uninstall_failed', 'uninstalled']),
'type' => $type,
];
});

0 comments on commit 1c45571

Please sign in to comment.