28 lines
815 B
PHP
28 lines
815 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class StockMutationFactory extends Factory
|
|
{
|
|
public function definition(): array
|
|
{
|
|
$stockBefore = fake()->randomFloat(4, 0, 1000);
|
|
$quantity = fake()->randomFloat(4, -100, 100);
|
|
|
|
return [
|
|
'stockable_type' => fake()->word(),
|
|
'stockable_id' => 1,
|
|
'type' => fake()->randomElement(['in', 'out', 'adjustment']),
|
|
'quantity' => $quantity,
|
|
'stock_before' => $stockBefore,
|
|
'stock_after' => $stockBefore + $quantity,
|
|
'stock_quality' => fake()->randomElement(['good', 'bad', 'damaged']),
|
|
'description' => fake()->sentence(),
|
|
'user_id' => User::factory(),
|
|
];
|
|
}
|
|
}
|