MessageFactory.php 659 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Database\Factories;
  3. use Illuminate\Database\Eloquent\Factories\Factory;
  4. use App\Models\User;
  5. /**
  6. * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Message>
  7. */
  8. class MessageFactory 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. 'title' => $this->faker->realText($maxNbChars = 20, $indexSize = 2),
  19. 'content' => $this->faker->realText($maxNbChars = 100, $indexSize = 2),
  20. 'writer' => $this->faker->randomElement(User::query()->get('id')),
  21. ];
  22. }
  23. }