attributes['file'] = base64_encode($value);
} else {
$this->attributes['file'] = $value;
}
}
public function getFileAttribute($value)
{
$drive = $this->driver;
$name = $this->name;
$root = $this->path;
if (($drive == 'database' || !$drive) && $value && base64_decode($value, true) === false) {
$value = base64_encode($value);
}
if ($drive && $drive !== 'database') {
$storage = new \App\FaveoStorage\Controllers\StorageController();
$content = $storage->getFile($drive, $name);
$value = base64_encode($content);
}
return $value;
}
public function getFile()
{
$size = $this->size;
$drive = $this->driver;
$name = $this->name;
$root = $this->path;
$units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
$power = $size > 0 ? floor(log($size, 1024)) : 0;
$value = number_format($size / pow(1024, $power), 2, '.', ',').' '.$units[$power];
if ($this->poster == 'ATTACHMENT') {
if (mime($this->type) == 'image') {
$var = '';
return '