Files
lotteryLaravel/app/Models/Player.php
wchino 15bd997c4e
Some checks failed
lotterLaravel CI / test (push) Has been cancelled
lotterLaravel E2E / e2e-api (push) Has been cancelled
feat(core): harden sessions settlement and credit activity
2026-07-22 20:53:43 +08:00

66 lines
1.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Models;
use App\Support\PlayerAuthSource;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* 主站玩家在本地映射账号(表 players与 SSO JWT 中 site_code + site_player_id 对应。
*/
final class Player extends Model
{
protected $fillable = [
'site_code',
'agent_node_id',
'site_player_id',
'auth_source',
'funding_mode',
'username',
'password_hash',
'nickname',
'default_currency',
'status',
'risk_tags',
'last_login_at',
'login_failed_count',
'login_locked_until',
'native_token_version',
'native_session_version',
];
protected $hidden = [
'password_hash',
];
protected function casts(): array
{
return [
'agent_node_id' => 'integer',
'last_login_at' => 'datetime',
'login_failed_count' => 'integer',
'login_locked_until' => 'datetime',
'native_token_version' => 'integer',
'native_session_version' => 'integer',
'risk_tags' => 'array',
];
}
public function isLotteryNative(): bool
{
return (string) $this->auth_source === PlayerAuthSource::LOTTERY_NATIVE;
}
public function wallets(): HasMany
{
return $this->hasMany(PlayerWallet::class);
}
public function agentNode(): BelongsTo
{
return $this->belongsTo(AgentNode::class, 'agent_node_id');
}
}