diff --git a/database/factories/AssetFactory.php b/database/factories/AssetFactory.php index 6414c55433..d1c4849a49 100644 --- a/database/factories/AssetFactory.php +++ b/database/factories/AssetFactory.php @@ -21,12 +21,11 @@ $factory->define(Asset::class, function (Faker\Generator $faker) { 'status_id' => 1, 'user_id' => 1, 'asset_tag' => $faker->unixTime('now'), - 'notes' => $faker->sentence, + 'notes' => 'Created by DB seeder', 'purchase_date' => $faker->dateTime(), 'purchase_cost' => $faker->randomFloat(2), 'order_number' => $faker->numberBetween(1000000, 50000000), 'supplier_id' => 1, - 'company_id' => 1, 'requestable' => $faker->boolean() ]; }); @@ -34,31 +33,104 @@ $factory->define(Asset::class, function (Faker\Generator $faker) { -$factory->state(Asset::class, 'asset-laptop', function ($faker) { +$factory->state(Asset::class, 'laptop-mbp', function ($faker) { return [ 'model_id' => 1 ]; }); -$factory->define(App\Models\AssetModel::class, function (Faker\Generator $faker) { + +$factory->state(Asset::class, 'laptop-air', function ($faker) { return [ - 'name' => $faker->catchPhrase, - 'manufacturer_id' => function () { - return factory(App\Models\Manufacturer::class)->create()->id; - }, - 'category_id' => function () { - return factory(App\Models\Category::class)->states('asset-desktop-category')->create()->id; - }, - 'model_number' => $faker->numberBetween(1000000, 50000000), - 'eol' => 1, - 'notes' => $faker->paragraph(), - 'requestable' => $faker->boolean(), - 'depreciation_id' => function () { - return factory(App\Models\Depreciation::class)->create()->id; - }, + 'model_id' => 2 ]; }); +$factory->state(Asset::class, 'laptop-surface', function ($faker) { + return [ + 'model_id' => 3 + ]; +}); + +$factory->state(Asset::class, 'laptop-xps', function ($faker) { + return [ + 'model_id' => 4 + ]; +}); + +$factory->state(Asset::class, 'laptop-spectre', function ($faker) { + return [ + 'model_id' => 5 + ]; +}); + +$factory->state(Asset::class, 'laptop-zenbook', function ($faker) { + return [ + 'model_id' => 6 + ]; +}); + +$factory->state(Asset::class, 'laptop-yoga', function ($faker) { + return [ + 'model_id' => 7 + ]; +}); + +$factory->state(Asset::class, 'desktop-macpro', function ($faker) { + return [ + 'model_id' => 8 + ]; +}); + +$factory->state(Asset::class, 'desktop-lenovo-i5', function ($faker) { + return [ + 'model_id' => 9 + ]; +}); + +$factory->state(Asset::class, 'desktop-optiplex', function ($faker) { + return [ + 'model_id' => 10 + ]; +}); + +$factory->state(Asset::class, 'conf-polycom', function ($faker) { + return [ + 'model_id' => 11 + ]; +}); + +$factory->state(Asset::class, 'conf-polycomcx', function ($faker) { + return [ + 'model_id' => 12 + ]; +}); + +$factory->state(Asset::class, 'tablet-ipad', function ($faker) { + return [ + 'model_id' => 13 + ]; +}); + +$factory->state(Asset::class, 'tablet-tab3', function ($faker) { + return [ + 'model_id' => 14 + ]; +}); + +$factory->state(Asset::class, 'phone-iphone6s', function ($faker) { + return [ + 'model_id' => 15 + ]; +}); + +$factory->state(Asset::class, 'phone-iphone7', function ($faker) { + return [ + 'model_id' => 16 + ]; +}); + + $factory->define(App\Models\AssetMaintenance::class, function (Faker\Generator $faker) { return [ 'asset_id' => function () {