Advertisement
Guest User

Untitled

a guest
Mar 19th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. |--------------------------------------------------------------------------
  5. | Model Factories
  6. |--------------------------------------------------------------------------
  7. |
  8. | Here you may define all of your model factories. Model factories give
  9. | you a convenient way to create models for testing and seeding your
  10. | database. Just tell the factory how a default model should look.
  11. |
  12. */
  13.  
  14. /** @var \Illuminate\Database\Eloquent\Factory $factory */
  15. $factory->define(App\User::class, function (Faker\Generator $faker) {
  16. static $password;
  17.  
  18. return [
  19. 'name' => $faker->name,
  20. 'email' => $faker->unique()->safeEmail,
  21. 'password' => $password ?: $password = bcrypt('secret'),
  22. 'remember_token' => str_random(10),
  23. ];
  24. });
  25.  
  26. $factory->define(App\Thread::class, function ($faker) {
  27. return [
  28. 'user_id' => function () {
  29. return factory('App\User')->create()->id;
  30. },
  31. 'title' => $faker->sentence,
  32. 'body' => $faker->paragraph
  33. ];
  34. });
  35.  
  36.  
  37. $factory->define(App\Reply::class, function ($faker) {
  38. return [
  39. 'thread_id' => function () {
  40. return factory('App\Thread')->create()->id;
  41. },
  42. 'user_id' => function () {
  43. return factory('App\User')->create()->id;
  44. },
  45. 'body' => $faker->paragraph
  46. ];
  47. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement