40 lines
692 B
PHP
40 lines
692 B
PHP
<?php
|
|
|
|
namespace app\model;
|
|
|
|
use think\model\Pivot;
|
|
use think\model\relation\HasOne;
|
|
|
|
|
|
/***
|
|
* 系统(用户/角色)关联模型
|
|
* @property int $id
|
|
* @property int $user_id
|
|
* @property int $role_id
|
|
* @property int $tenant_id
|
|
* @property string $create_time
|
|
* @property string $update_time
|
|
*/
|
|
class SysUserRole extends Pivot
|
|
{
|
|
protected $name = "sys_user_role";
|
|
protected $pk = "id";
|
|
|
|
/**
|
|
* 角色
|
|
* @return HasOne
|
|
*/
|
|
public function role(): HasOne
|
|
{
|
|
return $this->hasOne(SysRole::class);
|
|
}
|
|
|
|
/**
|
|
* 用户
|
|
* @return HasOne
|
|
*/
|
|
public function user(): HasOne
|
|
{
|
|
return $this->hasOne(SysUser::class);
|
|
}
|
|
} |