34 lines
723 B
PHP
34 lines
723 B
PHP
![]() |
<?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',
|
||
|
]);
|
||
|
}
|
||
|
|
||
|
}
|