TestUserFactory.php 694 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Knuckles\Scribe\Tests\Fixtures\inmemory;
  3. use Illuminate\Database\Eloquent\Factories\Factory;
  4. class TestUserFactory extends Factory
  5. {
  6. protected $model = TestUser::class;
  7. public function configure()
  8. {
  9. return $this->afterCreating(function (TestUser $user) {
  10. $user->load([
  11. 'children.pets',
  12. 'work.departments',
  13. ]);
  14. });
  15. }
  16. /**
  17. * @inheritDoc
  18. */
  19. public function definition()
  20. {
  21. return [
  22. 'first_name' => 'Tested',
  23. 'last_name' => 'Again',
  24. 'email' => 'a@b.com',
  25. 'test_work_id' => TestWork::factory(),
  26. ];
  27. }
  28. }