This commit is contained in:
Beppe 2024-09-09 12:28:35 +02:00
commit ad3b4d9647
1 changed files with 6 additions and 4 deletions

View File

@ -74,11 +74,13 @@ class Upload extends Model
$model = new static();
// Informazioni di base
$name = $data['name'] ?? $name;
$name ??= basename($source);
$original_name = basename($source) ?? $name;
$category = $data['category'] ?? $category;
if (empty($name)) {
$name = $data['name'] ?? ($source['name'] ?? $source);
}
$original_name = $source['name'] ?? $name;
$category = $data['category'] ?? $category;
// Nome e categoria dell'allegato
$model->name = !empty($name) ? $name : $original_name;
$model->category = $category;