Fix conflitto Eloquent

This commit is contained in:
Thomas Zilio 2019-07-19 18:11:07 +02:00
parent 69071050f0
commit ad21ebf9f2
3 changed files with 16 additions and 3 deletions

View File

@ -134,7 +134,7 @@ switch (post('op')) {
$dst = $src; $dst = $src;
} else { } else {
$src = basename($fattura->uploads()->where('name', 'Fattura Elettronica')->first()->filepath); $src = basename($fattura->uploads()->where('name', 'Fattura Elettronica')->first()->filepath);
$dst = basename($fattura->uploads()->where('name', 'Fattura Elettronica')->first()->original); $dst = basename($fattura->uploads()->where('name', 'Fattura Elettronica')->first()->original_name);
} }
$file = slashes($module->upload_directory.'/'.$src); $file = slashes($module->upload_directory.'/'.$src);

View File

@ -31,7 +31,7 @@ class Upload extends Model
$model = parent::build(); $model = parent::build();
// Informazioni di base // Informazioni di base
$model->attributes['original'] = $original_name; // Fix per original di Eloquent $model->original_name = $original_name; // Fix per original di Eloquent
$model->size = $source['size']; $model->size = $source['size'];
$model->name = !empty($name) ? $name : $original_name; $model->name = !empty($name) ? $name : $original_name;
@ -103,6 +103,19 @@ class Upload extends Model
return $this->directory.'/'.$this->filename; return $this->directory.'/'.$this->filename;
} }
/**
* @return string
*/
public function getOriginalNameAttribute()
{
return $this->attributes['original'];
}
public function setOriginalNameAttribute($value)
{
$this->attributes['original'] = $value;
}
/** /**
* @return bool * @return bool
*/ */

View File

@ -18,7 +18,7 @@ if ($file->isFatturaElettronica()) {
// Individuazione stylesheet // Individuazione stylesheet
$default_stylesheet = 'asso-invoice'; $default_stylesheet = 'asso-invoice';
$name = basename($file->original); $name = basename($file->original_name);
$filename = explode('.', $name)[0]; $filename = explode('.', $name)[0];
$pieces = explode('_', $filename); $pieces = explode('_', $filename);
$stylesheet = $pieces[2]; $stylesheet = $pieces[2];