2017-10-07 05:30:53 -07:00
|
|
|
<?php
|
2021-06-10 13:19:27 -07:00
|
|
|
|
2021-06-10 13:17:44 -07:00
|
|
|
namespace Database\Factories;
|
|
|
|
|
2023-03-14 11:34:58 -07:00
|
|
|
use App\Models\User;
|
2021-06-10 13:19:27 -07:00
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
2017-10-07 05:30:53 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Asset Model Factories
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Factories related exclusively to creating models ..
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2021-06-10 13:17:44 -07:00
|
|
|
class DepreciationFactory extends Factory
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $model = \App\Models\Depreciation::class;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the model's default state.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function definition()
|
|
|
|
{
|
|
|
|
return [
|
2021-12-02 19:19:42 -08:00
|
|
|
'name' => $this->faker->catchPhrase(),
|
2023-03-14 11:34:58 -07:00
|
|
|
'user_id' => function () {
|
|
|
|
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
|
|
|
},
|
2021-12-02 19:19:42 -08:00
|
|
|
'months' => 36,
|
2021-06-10 13:17:44 -07:00
|
|
|
];
|
|
|
|
}
|
2017-10-07 05:30:53 -07:00
|
|
|
|
2021-06-10 13:17:44 -07:00
|
|
|
public function computer()
|
|
|
|
{
|
|
|
|
return $this->state(function () {
|
|
|
|
return [
|
|
|
|
'name' => 'Computer Depreciation',
|
|
|
|
'months' => 36,
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
2017-10-07 05:30:53 -07:00
|
|
|
|
2021-06-10 13:17:44 -07:00
|
|
|
public function display()
|
|
|
|
{
|
|
|
|
return $this->state(function () {
|
|
|
|
return [
|
|
|
|
'name' => 'Display Depreciation',
|
|
|
|
'months' => 12,
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
2017-10-07 05:30:53 -07:00
|
|
|
|
2021-06-10 13:17:44 -07:00
|
|
|
public function mobilePhones()
|
|
|
|
{
|
|
|
|
return $this->state(function () {
|
|
|
|
return [
|
|
|
|
'name' => 'Mobile Phone Depreciation',
|
|
|
|
'months' => 24,
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|