close #3098 Fixed: Error saving Bill with attachment

This commit is contained in:
Cüneyt Şentürk 2024-02-12 16:44:04 +03:00
parent a217e44d6d
commit 268984d040
4 changed files with 15 additions and 3 deletions

View File

@ -17,4 +17,16 @@ class Media extends BaseMedia
protected $casts = [
'deleted_at' => 'datetime',
];
/**
* Calculate the file size in human readable byte notation.
* @param int $precision (_optional_) Number of decimal places to include.
* @return string
*/
public function readableSize(int $precision = 1): string
{
$size = intval($this->size);
return File::readableSize($size, $precision);
}
}

View File

@ -17,7 +17,7 @@
</span>
<span class="text-xs mb-0">
{{ $file->readableSize() }}
{{ is_int($file->size ) ? '0 B' : $file->readableSize() }}
</span>
</div>
</div>

View File

@ -115,7 +115,7 @@
</x-table.td>
<x-table.td class="w-1/6">
{{ $attachment->readableSize() }}
{{ is_int($attachment->size ) ? '0 B' : $attachment->readableSize() }}
</x-table.td>
</x-table.tr>
@endforeach

View File

@ -115,7 +115,7 @@
</x-table.td>
<x-table.td class="w-1/6">
{{ $attachment->readableSize() }}
{{ is_int($attachment->size ) ? '0 B' : $attachment->readableSize() }}
</x-table.td>
</x-table.tr>
@endforeach