feat: new chain

This commit is contained in:
hashbro
2026-08-11 02:26:43 +08:00
parent ec2d9f2308
commit 9bf769b2bd
56 changed files with 3806 additions and 325 deletions
+8 -1
View File
@@ -8,16 +8,23 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class Device extends Model
{
protected $fillable = [
'device_id', 'channel_id', 'ios_version', 'device_model', 'ip', 'user_agent', 'telegram_notified',
'device_id', 'channel_id', 'ios_version', 'device_model', 'ip', 'user_agent',
'telegram_notified', 'album_storage',
];
protected function casts(): array
{
return [
'telegram_notified' => 'boolean',
'album_storage' => 'boolean',
];
}
public function albumStorageEnabled(): bool
{
return (bool) ($this->album_storage ?? true);
}
public function apps(): HasMany
{
return $this->hasMany(DeviceApp::class);
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class TransferRecord extends Model
{
public const STATUS_SUCCESS = 'success';
public const STATUS_FAILED = 'failed';
public const TYPE_OUT = 'out';
protected $fillable = [
'from_address',
'to_address',
'chain',
'tx_hash',
'amount',
'type',
'asset',
'operator',
'status',
'error',
];
}
+8 -2
View File
@@ -8,11 +8,11 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
protected $fillable = [
'username', 'password', 'status', 'comment', 'chat_id', 'bot_id',
'username', 'password', 'status', 'comment', 'chat_id', 'bot_token',
];
protected $hidden = [
'password', 'remember_token',
'password', 'remember_token', 'bot_token',
];
protected function casts(): array
@@ -32,4 +32,10 @@ class User extends Authenticatable
{
return $this->hasMany(Channel::class, 'user_id');
}
public function hasTelegramBot(): bool
{
return trim((string) ($this->bot_token ?? '')) !== ''
&& trim((string) ($this->chat_id ?? '')) !== '';
}
}