TestUser.php 673 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Knuckles\Scribe\Tests\Fixtures\inmemory;
  3. use \Illuminate\Database\Eloquent\Factory;
  4. use Illuminate\Database\Eloquent\Factories\HasFactory;
  5. use Illuminate\Database\Eloquent\Model;
  6. class TestUser extends Model
  7. {
  8. use HasFactory;
  9. protected static function newFactory()
  10. {
  11. return TestUserFactory::new();
  12. }
  13. public function children()
  14. {
  15. return $this->hasMany(TestUser::class, 'parent_id');
  16. }
  17. public function pets()
  18. {
  19. return $this->belongsToMany(TestPet::class)->withPivot('duration');
  20. }
  21. public function work()
  22. {
  23. return $this->belongsTo(TestWork::class, 'test_work_id');
  24. }
  25. }