'integer', 'downloads_total' => 'integer', ]; public function transfer(): BelongsTo { return $this->belongsTo(Transfer::class); } public function downloadEvents(): HasMany { return $this->hasMany(TransferDownloadEvent::class); } public function humanSize(): string { $bytes = $this->size_bytes; if ($bytes >= 1073741824) { return number_format($bytes / 1073741824, 1).' GB'; } if ($bytes >= 1048576) { return number_format($bytes / 1048576, 1).' MB'; } if ($bytes >= 1024) { return number_format($bytes / 1024, 0).' KB'; } return $bytes.' B'; } public function existsOnDisk(): bool { return Storage::disk($this->disk)->exists($this->path); } }