Generalizzato i documenti issue #5
This commit is contained in:
@@ -14,7 +14,7 @@ class GenDoc extends Model
|
||||
|
||||
public static function saveDocument($data){
|
||||
|
||||
$filename=$data->file('filename')->store('Documenti');
|
||||
$filename=$data->file('filename')->store(self::getEntityFolder($data['entity']));
|
||||
DB::table('gen_docs')
|
||||
->insert([
|
||||
'entity'=>$data['entity'],
|
||||
@@ -27,8 +27,8 @@ class GenDoc extends Model
|
||||
public static function listDocument($entity,$entity_id)
|
||||
{
|
||||
// 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();
|
||||
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){
|
||||
@@ -40,5 +40,14 @@ class GenDoc extends Model
|
||||
return $quanti;
|
||||
}
|
||||
|
||||
|
||||
private static function getEntityFolder($entity)
|
||||
{
|
||||
$entity_resolve=[
|
||||
0=>'Movimenti',
|
||||
1=>'Contratti',
|
||||
2=>'Automobili',
|
||||
3=>'Progetti',
|
||||
];
|
||||
return $entity_resolve[$entity];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user