TypeModel.php 536 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Model;
  4. class TypeModel extends BaseModel
  5. {
  6. /**
  7. * 表名.
  8. *
  9. * @var string
  10. */
  11. protected $table = 'type';
  12. public function video()
  13. {
  14. return $this->hasMany(TypeVideoModel::class, 'type_id', 'id');
  15. }
  16. public function upvideo()
  17. {
  18. return $this->hasMany(TypeVideoModel::class, 'type_id', 'id')->where('status', 1);
  19. }
  20. public function users()
  21. {
  22. return $this->hasMany(UserTagModel::class, 'tag_id', 'id');
  23. }
  24. }