Added Download file, play for homebrews and ZIP explorer.

This commit is contained in:
2026-06-16 18:35:01 +02:00
parent 7e1e26f20b
commit 279160c1cb
12 changed files with 215 additions and 24 deletions

View File

@@ -62,6 +62,23 @@ class EntryFile extends Model
return $this->hasOne(PlayOnlineSetting::class,'file_id');
}
public function prettyFileSize(): string
{
$bytes = $this->filesize;
if ($bytes >= 1073741824) {
$bytes = number_format($bytes / 1073741824, 2) . ' GB';
} elseif ($bytes >= 1048576) {
$bytes = number_format($bytes / 1048576, 2) . ' MB';
} elseif ($bytes >= 1024) {
$bytes = number_format($bytes / 1024, 2) . ' KB';
} else {
$bytes = ($bytes == 0) ? '0 bytes' : $bytes . ' bytes';
}
return $bytes;
}
public function increaseDownloadCount(): void
{
$this->download_count++;