38 lines
882 B
PHP
38 lines
882 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Modules\Catalog\Infrastructure\Persistence\Eloquent\ServiceUnitModel;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<ServiceUnitModel>
|
|
*/
|
|
class ServiceUnitFactory extends Factory
|
|
{
|
|
protected $model = ServiceUnitModel::class;
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => fake()->unique()->words(2, true),
|
|
'is_shared' => false,
|
|
'is_active' => true,
|
|
'sort_order' => fake()->unique()->numberBetween(100, 100000),
|
|
];
|
|
}
|
|
|
|
public function usingStock(): static
|
|
{
|
|
return $this->state(fn (): array => ['uses_stock' => true]);
|
|
}
|
|
|
|
public function inactive(): static
|
|
{
|
|
return $this->state(fn (): array => ['is_active' => false]);
|
|
}
|
|
}
|