mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Depreciations factory
This commit is contained in:
parent
e9c77198d7
commit
ecfe1a5442
41
database/factories/DepreciationFactory.php
Normal file
41
database/factories/DepreciationFactory.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Asset Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Factories related exclusively to creating models ..
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\Models\Depreciation::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'user_id' => 1,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Depreciation::class, 'computer', function ($faker) {
|
||||
return [
|
||||
'name' => 'Computer Depreciation',
|
||||
'months' => 36,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Depreciation::class, 'display', function ($faker) {
|
||||
return [
|
||||
'name' => 'Display Depreciation',
|
||||
'months' => 12,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Depreciation::class, 'mobile-phones', function ($faker) {
|
||||
return [
|
||||
'name' => 'Mobile Phone Depreciation',
|
||||
'months' => 24,
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
@ -7,6 +7,8 @@ class DepreciationSeeder extends Seeder
|
|||
public function run()
|
||||
{
|
||||
Depreciation::truncate();
|
||||
factory(Depreciation::class, 5)->create();
|
||||
factory(Depreciation::class, 1)->states('computer')->create(); // 1
|
||||
factory(Depreciation::class, 1)->states('display')->create(); // 2
|
||||
factory(Depreciation::class, 1)->states('mobile-phones')->create(); // 3
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue