*/ protected $guarded = []; public function role(): HasOne { return $this->hasOne(RoleModel::class, 'id', 'role_id'); } /** * 所属部门 * * 部门表在 business 连接(cc_ 前缀),Eloquent 关联可以跨连接, * 但不能和本表做 SQL join,需要 join 时只能分两次查再在 PHP 里拼。 */ public function department(): HasOne { return $this->hasOne(DepartmentModel::class, 'id', 'department_id'); } }