TopicCategoryModel.php 544 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * 话题分类模型.
  4. *
  5. * @author jim <jim458734573@gmail.com>
  6. * @date 2020-01-29 10:09:06
  7. */
  8. declare(strict_types=1);
  9. namespace App\Model;
  10. use Hyperf\ModelCache\Cacheable;
  11. use Hyperf\ModelCache\CacheableInterface;
  12. class TopicCategoryModel extends BaseModel implements CacheableInterface
  13. {
  14. use Cacheable;
  15. /**
  16. * 表名.
  17. *
  18. * @var string
  19. */
  20. protected $table = 'topic_category';
  21. public function topics()
  22. {
  23. return $this->hasMany(TopicModel::class, 'category_id', 'id');
  24. }
  25. }