39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Modules\Inventory\Domain\Enums\StockUnit;
|
|
use App\Modules\Inventory\Infrastructure\Persistence\Eloquent\StockItemGroupModel;
|
|
use App\Modules\Inventory\Infrastructure\Persistence\Eloquent\StockItemModel;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<StockItemModel>
|
|
*/
|
|
class StockItemFactory extends Factory
|
|
{
|
|
protected $model = StockItemModel::class;
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'stock_item_group_id' => StockItemGroupModel::factory(),
|
|
'name' => fake()->unique()->words(3, true),
|
|
'unit' => StockUnit::Piece,
|
|
'code' => null,
|
|
'supplier' => null,
|
|
'reorder_level_milli' => null,
|
|
'average_cost_hundredths' => 0,
|
|
'is_active' => true,
|
|
];
|
|
}
|
|
|
|
public function inactive(): static
|
|
{
|
|
return $this->state(fn (): array => ['is_active' => false]);
|
|
}
|
|
}
|