Add stock items, groups and movements at a moving average cost
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?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]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Modules\Inventory\Infrastructure\Persistence\Eloquent\StockItemGroupModel;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<StockItemGroupModel>
|
||||
*/
|
||||
class StockItemGroupFactory extends Factory
|
||||
{
|
||||
protected $model = StockItemGroupModel::class;
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->unique()->words(2, true),
|
||||
'sort_order' => fake()->unique()->numberBetween(1, 100000),
|
||||
'is_active' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user