corretto path ed Entity_id di default
This commit is contained in:
parent
e99ac1def0
commit
fbb92e1e0c
@ -12,20 +12,18 @@ class GenDoc extends Model
|
|||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
// DocumentiGenerali
|
|
||||||
|
|
||||||
public static function saveDocument($data){
|
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');
|
$file=$data->file('filename');
|
||||||
$filename = $file->hashName();
|
$filename = $file->hashName();
|
||||||
$path=self::getEntityFolder($data['entity'])."/";
|
$path=self::getEntityFolder($data['entity'])."/";
|
||||||
$upload = Storage::put($path.$filename,$file);
|
$upload = Storage::put($path.$filename,$file);
|
||||||
// dd($filename);
|
|
||||||
DB::table('gen_docs')
|
DB::table('gen_docs')
|
||||||
->insert([
|
->insert([
|
||||||
'entity'=>$data['entity'],
|
'entity'=>$data['entity'],
|
||||||
'entity_id'=>($data['entity_id'] ?? 0 ),
|
'entity_id'=>($data['entity_id'] ?? 1 ),
|
||||||
'descrizione'=>$data['descrizione'],
|
'descrizione'=>$data['descrizione'],
|
||||||
'filename'=>$path.$filename,
|
'filename'=>$path.$filename,
|
||||||
]);
|
]);
|
||||||
@ -33,9 +31,11 @@ class GenDoc extends Model
|
|||||||
|
|
||||||
public static function listDocument($entity,$entity_id = 1)
|
public static function listDocument($entity,$entity_id = 1)
|
||||||
{
|
{
|
||||||
// Ritorna la lista dei documenti in base all'entità e al rispettivo 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('gen_docs')->where('entity','=',$entity)->where('entity_id','=',$entity_id)->get();
|
||||||
// return DB::table('documentis')->where('movimenti_id','=', $entity_id)->get();
|
//nuova funzione
|
||||||
|
|
||||||
|
// return DB::table('documentis')->where('movimenti_id','=', $entity_id)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function countDocument($entity,$entity_id = 1){
|
public static function countDocument($entity,$entity_id = 1){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user