refactor: kb & station & terminal

This commit is contained in:
2026-03-23 20:17:17 +08:00
parent 63ea2686e1
commit b74ba1a3f8
81 changed files with 1016 additions and 2492 deletions

View File

@@ -50,11 +50,28 @@ class User extends Authenticatable
}
/**
* 获取用户所属的所有分组
* 获取用户关联的线站
*/
public function groups(): BelongsToMany
public function stations(): BelongsToMany
{
return $this->belongsToMany(Group::class);
return $this->belongsToMany(Station::class);
}
/**
* 获取用户可访问的线站 IDs
* 空数组表示无限制(管理员)
*/
public function getAccessibleStationIds(): array
{
return $this->stations()->pluck('stations.id')->toArray();
}
/**
* 用户是否受线站限制
*/
public function hasStationRestriction(): bool
{
return $this->stations()->exists();
}
/**