ProductFactory.php 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Database\Factories;
  3. use App\Models\Product;
  4. use Illuminate\Database\Eloquent\Factories\Factory;
  5. /**
  6. * @extends Factory<Product>
  7. */
  8. class ProductFactory extends Factory
  9. {
  10. protected $model = Product::class;
  11. public function definition(): array
  12. {
  13. return [
  14. 'year' => (int) date('Y'),
  15. 'article' => fake()->unique()->bothify('MAF-####'),
  16. 'name_tz' => fake()->sentence(3),
  17. 'type_tz' => fake()->randomElement(['Горка', 'Качели', 'Песочница', 'Карусель']),
  18. 'nomenclature_number' => fake()->numerify('######'),
  19. 'sizes' => fake()->numerify('####x####x####'),
  20. 'manufacturer' => fake()->company(),
  21. 'unit' => 'шт',
  22. 'type' => fake()->randomElement(['standard', 'custom']),
  23. 'product_price' => fake()->randomFloat(2, 10000, 500000),
  24. 'installation_price' => fake()->randomFloat(2, 5000, 50000),
  25. 'total_price' => fake()->randomFloat(2, 15000, 550000),
  26. 'service_life' => fake()->numberBetween(5, 15),
  27. ];
  28. }
  29. }