Added Download file, play for homebrews and ZIP explorer.
This commit is contained in:
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user