Fix upload da API
This commit is contained in:
parent
0024c1a766
commit
515f5074b8
|
@ -4,6 +4,7 @@ namespace Modules\Interventi\API\v1;
|
|||
|
||||
use API\Interfaces\UpdateInterface;
|
||||
use API\Resource;
|
||||
use Models\Upload;
|
||||
|
||||
class Firma extends Resource implements UpdateInterface
|
||||
{
|
||||
|
@ -12,6 +13,7 @@ class Firma extends Resource implements UpdateInterface
|
|||
$database = database();
|
||||
$data = $request['data'];
|
||||
|
||||
//$file = Upload::find($data['file_id']);
|
||||
$database->update('in_interventi', [
|
||||
'firma_file' => $data['firma_file'],
|
||||
'firma_data' => $data['firma_data'],
|
||||
|
|
|
@ -4,8 +4,8 @@ namespace Api\Common;
|
|||
|
||||
use API\Interfaces\CreateInterface;
|
||||
use API\Resource;
|
||||
use Models\Upload;
|
||||
use Modules;
|
||||
use Uploads;
|
||||
|
||||
class Allegato extends Resource implements CreateInterface
|
||||
{
|
||||
|
@ -13,14 +13,17 @@ class Allegato extends Resource implements CreateInterface
|
|||
{
|
||||
$module = Modules::get($request['module']);
|
||||
|
||||
$upload = Uploads::upload($_FILES['upload'], [
|
||||
'name' => $request['name'],
|
||||
$name = !empty($request['name']) ? $request['name'] : null;
|
||||
$category = !empty($request['category']) ? $request['category'] : null;
|
||||
|
||||
$upload = Upload::build($_FILES['upload'], [
|
||||
'id_module' => $module['id'],
|
||||
'id_record' => $request['id'],
|
||||
]);
|
||||
], $name, $category);
|
||||
|
||||
return[
|
||||
'filename' => $upload,
|
||||
'id' => $upload->id,
|
||||
'filename' => $upload->filename,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue