You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.2 KiB

2 years ago
  1. <?php
  2. namespace Database\Factories;
  3. use App\Models\Collection;
  4. use Illuminate\Database\Eloquent\Factories\Factory;
  5. /**
  6. * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\File>
  7. */
  8. class FileFactory extends Factory
  9. {
  10. /**
  11. * Define the model's default state.
  12. *
  13. * @return array<string, mixed>
  14. */
  15. public function definition()
  16. {
  17. return [
  18. "uuid" => 1,
  19. "original_name" => fake()->name(),
  20. "ext" => ['jpg', 'jpeg', 'png', 'webp'][rand(0, 3)],
  21. "memetype" => 'image',
  22. "width" => rand(300, 2000),
  23. "height" => rand(300, 2000),
  24. "file_size" => rand(300, 2000),
  25. "server_path" => date('y') . '/' . date('m'),
  26. "sort" => rand(0, 23),
  27. "alts" => [
  28. 'hello wroldswdfouiwref iuwrhgf ow rgfaw ghfawej',
  29. 'jhsf asduyfsadf sadf safsuf isfjsdfsudifsduiyf sdiuf sd'
  30. ],
  31. "description" => 'ajsfoisahjfoaspf asduf safsafjsh lh',
  32. "user_id" => rand(43724, 382348),
  33. "ip" => "127.0. 0.1",
  34. "collection_id" => Collection::factory()->create()->id,
  35. "published_at" => "2022-07-27 09:17:59",
  36. ];
  37. }
  38. }