// +---------------------------------------------------------------------- declare (strict_types=1); namespace app\common\model; use cores\BaseModel; use think\model\relation\HasOne; use app\common\model\store\Shop; /** * 用户模型类 * Class User * @package app\common\model */ class UserFeedback extends BaseModel { // 定义表名 protected $name = 'user_feedback'; // 定义主键 protected $pk = 'id'; /** * 关联用户 * @return HasOne */ public function user(): HasOne { return $this->hasOne('user', 'user_id', 'user_id'); } /** * 关联门店 * @return HasOne */ public function shop(): HasOne { return $this->hasOne(Shop::class, 'shop_id', 'shop_id'); } }