corretto path ed Entity_id di default

This commit is contained in:
Amministratore 2025-10-21 16:12:54 +02:00 committed by Flavio Barachino
parent a7b502bb02
commit 402c566107

View File

@ -12,20 +12,18 @@ class GenDoc extends Model
{
use HasFactory;
// DocumentiGenerali
public static function saveDocument($data){
//$filename = $data->file('filename')->store(self::getEntityFolder($data['entity']));
// $filename = $data->file('filename')->store(self::getEntityFolder($data['entity']));
$file=$data->file('filename');
$filename = $file->hashName();
$path=self::getEntityFolder($data['entity'])."/";
$upload = Storage::put($path.$filename,$file);
// dd($filename);
DB::table('gen_docs')
->insert([
'entity'=>$data['entity'],
'entity_id'=>($data['entity_id'] ?? 0 ),
'entity_id'=>($data['entity_id'] ?? 1 ),
'descrizione'=>$data['descrizione'],
'filename'=>$path.$filename,
]);
@ -34,7 +32,9 @@ class GenDoc extends Model
public static function listDocument($entity,$entity_id = 1)
{
// Ritorna la lista dei documenti in base all'entità e al rispettivo id
return DB::table('gen_docs')->where('entity','=',$entity)->where('entity_id','=',$entity_id)->get(); //nuova funzione
return DB::table('gen_docs')->where('entity','=',$entity)->where('entity_id','=',$entity_id)->get();
//nuova funzione
// return DB::table('documentis')->where('movimenti_id','=', $entity_id)->get();
}