From fbb92e1e0c02c38d723677d5b1b6686c95116c87 Mon Sep 17 00:00:00 2001 From: Flavio Barachino Date: Tue, 21 Oct 2025 16:12:54 +0200 Subject: [PATCH] corretto path ed Entity_id di default --- app/Models/GenDoc.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Models/GenDoc.php b/app/Models/GenDoc.php index 6845b14..4b529fb 100644 --- a/app/Models/GenDoc.php +++ b/app/Models/GenDoc.php @@ -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, ]); @@ -33,9 +31,11 @@ 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('documentis')->where('movimenti_id','=', $entity_id)->get(); + // 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('documentis')->where('movimenti_id','=', $entity_id)->get(); } public static function countDocument($entity,$entity_id = 1){