course/app/common/model/ChatFriend.php

34 lines
723 B
PHP
Raw Normal View History

<?php
namespace app\common\model;
use app\BaseModel;
use support\Model;
class ChatFriend extends BaseModel
{
/**
* @desc 好友信息
* @return \think\model\relation\HasOne
*/
public function friend()
{
return $this->hasOne(User::class, 'id', 'friend_id')->bind(['nickname', 'avatar', 'is_photographer']);
}
/**
* @desc 好友摄影师信息
* @return \think\model\relation\HasOne
*/
public function photographer()
{
return $this->hasOne(Photographer::class, 'id', 'photographer_id')->bind([
// 'photographer_id' => 'id',
'photographer_name' => 'name',
'photographer_avatar' => 'avatar',
]);
}
}