PostFactory.php 744 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace Database\Factories;
  11. use App\Repositories\Models\Post;
  12. use Illuminate\Database\Eloquent\Factories\Factory;
  13. class PostFactory extends Factory
  14. {
  15. protected $model = Post::class;
  16. public function definition()
  17. {
  18. return [
  19. 'title' => $this->faker->sentence,
  20. 'body' => $this->faker->paragraph(3),
  21. 'published' => $this->faker->numberBetween(0, 1),
  22. 'user_id' => $this->faker->randomElement([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
  23. ];
  24. }
  25. }