| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- /**
- * 话题模型.
- *
- * @author jim <jim458734573@gmail.com>
- * @date 2020-01-29 10:08:58
- */
- declare(strict_types=1);
- namespace App\Model;
- use Hyperf\ModelCache\Cacheable;
- use Hyperf\ModelCache\CacheableInterface;
- class TopicModel extends BaseModel implements CacheableInterface
- {
- use Cacheable;
- /**
- * 表名.
- *
- * @var string
- */
- protected $table = 'topic';
- /**
- * 分类.
- * @return \Hyperf\Database\Model\Relations\HasOne
- */
- public function category()
- {
- return $this->hasOne(TopicCategoryModel::class, 'id', 'category_id');
- }
- /**
- * 用户.
- * @return \Hyperf\Database\Model\Relations\HasOne
- */
- public function user()
- {
- return $this->hasOne(UserModel::class, 'code', 'user_id');
- }
- }
|