CustomFieldFactory.php 874 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Database\Factories;
  3. use Illuminate\Database\Eloquent\Factories\Factory;
  4. /**
  5. * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\CustomField>
  6. */
  7. class CustomFieldFactory extends Factory
  8. {
  9. /**
  10. * Define the model's default state.
  11. *
  12. * @return array<string, mixed>
  13. */
  14. public function definition(): array
  15. {
  16. return [
  17. 'group' => config("custom-field.groups")[array_rand(config("custom-field.groups"))],
  18. 'key' => fake()->name(),
  19. 'label' => [
  20. 'en' => 'en',
  21. 'zh' => '中文',
  22. ],
  23. 'type' => 3,
  24. 'options' => [
  25. "value" => fake()->name(),
  26. "lang" => [
  27. 'en' => 'en',
  28. 'zh' => '中文',
  29. ]
  30. ]
  31. ];
  32. }
  33. }