User traffic can now be viewed by node

This commit is contained in:
socksprox
2025-11-29 12:37:23 +01:00
parent 95e8e7bca7
commit 9e35d16fa6
4 changed files with 243 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Model;
*
* @property int $id
* @property int $user_id 用户ID
* @property int|null $server_id 节点ID (nullable for legacy data)
* @property int $u 上行流量
* @property int $d 下行流量
* @property int $record_at 记录时间
@@ -25,4 +26,12 @@ class StatUser extends Model
'created_at' => 'timestamp',
'updated_at' => 'timestamp'
];
/**
* Get the server that this traffic stat belongs to
*/
public function server()
{
return $this->belongsTo(Server::class, 'server_id');
}
}