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;
} else {
$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);

View File

@ -31,7 +31,7 @@ class Upload extends Model
$model = parent::build();
// 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->name = !empty($name) ? $name : $original_name;
@ -103,6 +103,19 @@ class Upload extends Model
return $this->directory.'/'.$this->filename;
}
/**
* @return string
*/
public function getOriginalNameAttribute()
{
return $this->attributes['original'];
}
public function setOriginalNameAttribute($value)
{
$this->attributes['original'] = $value;
}
/**
* @return bool
*/

View File

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