| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- /**
- * 评论模型.
- *
- * @author jim <jim458734573@gmail.com>
- * @date 2020-01-28 20:16:26
- */
- declare(strict_types=1);
- namespace App\Model;
- use Hyperf\ModelCache\Cacheable;
- use Hyperf\ModelCache\CacheableInterface;
- class CommentModel extends BaseModel implements CacheableInterface
- {
- use Cacheable;
- /**
- * 表名.
- *
- * @var string
- */
- protected $table = 'comment';
- protected $casts = [
- 'content' => 'string',
- 'quote' => 'string',
- ];
- /**
- * 关联一个用户.
- * @return \Hyperf\Database\Model\Relations\HasOne
- */
- public function user()
- {
- return $this->hasOne(UserModel::class, 'code', 'user_id');
- }
- }
|