Akaunting/app/Models/Common/Media.php

34 lines
801 B
PHP
Raw Normal View History

2017-12-29 16:56:56 +00:00
<?php
namespace App\Models\Common;
2021-09-07 07:33:34 +00:00
use App\Traits\Owners;
use App\Traits\Sources;
2021-05-17 19:32:45 +00:00
use App\Traits\Tenants;
2017-12-29 16:56:56 +00:00
use Illuminate\Database\Eloquent\SoftDeletes;
2019-11-16 07:21:14 +00:00
use Plank\Mediable\Media as BaseMedia;
2024-02-12 14:07:37 +00:00
use Plank\Mediable\Helpers\File;
2017-12-29 16:56:56 +00:00
2019-11-16 07:21:14 +00:00
class Media extends BaseMedia
2017-12-29 16:56:56 +00:00
{
2021-09-07 07:33:34 +00:00
use Owners, SoftDeletes, Sources, Tenants;
2017-12-29 16:56:56 +00:00
2021-09-07 07:33:34 +00:00
protected $fillable = ['company_id', 'created_from', 'created_by'];
2023-03-16 13:36:13 +00:00
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);
}
2018-01-02 13:22:30 +00:00
}