* @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'); } }