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.

51 lines
1.4 KiB

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