Skip to content

Commit a95c375

Browse files
authored
Merge pull request #45 from offline-agency/feat-add-product-entity
feat: add product entity
2 parents 71e528c + f07683e commit a95c375

File tree

2 files changed

+77
-6
lines changed

2 files changed

+77
-6
lines changed

src/Entities/Prodotti.php

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?php
2+
3+
namespace OfflineAgency\FattureInCloud\Entities;
4+
5+
use Exception;
6+
use OfflineAgency\FattureInCloud\Requests\Prodotti as Request;
7+
8+
class Prodotti extends Anagrafica
9+
{
10+
/**
11+
* @param array $data
12+
* @return mixed|string
13+
*
14+
* @throws Exception
15+
*/
16+
public function lista($data = [])
17+
{
18+
Request::lista($data);
19+
20+
return $this->auth->post('prodotti/lista', $data);
21+
}
22+
23+
/**
24+
* @param array $data
25+
* @return mixed|string
26+
*
27+
* @throws Exception
28+
*/
29+
public function nuovo($data = [])
30+
{
31+
Request::nuovo($data);
32+
33+
return $this->auth->post('prodotti/nuovo', $data);
34+
}
35+
36+
/**
37+
* @param array $data
38+
* @return mixed|string
39+
*
40+
* @throws Exception
41+
*/
42+
public function importa($data = [])
43+
{
44+
Request::dettagli($data);
45+
46+
return $this->auth->post('prodotti/dettagli', $data);
47+
}
48+
49+
/**
50+
* @param array $data
51+
* @return mixed|string
52+
*
53+
* @throws Exception
54+
*/
55+
public function modifica($data = [])
56+
{
57+
Request::modifica($data);
58+
59+
return $this->auth->post('prodotti/modifica', $data);
60+
}
61+
62+
/**
63+
* @param array $data
64+
* @return mixed|string
65+
*
66+
* @throws Exception
67+
*/
68+
public function elimina($data = [])
69+
{
70+
Request::elimina($data);
71+
72+
return $this->auth->post('prodotti/elimina', $data);
73+
}
74+
}

src/Requests/Prodotti.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ public static function lista($data = [])
2929
*/
3030
public static function nuovo($data = [])
3131
{
32-
$allowed = ['cod', 'nome', 'desc', 'prezzo_ivato', 'prezzo_netto', 'prezzo_lordo', 'costo', 'cod_iva', 'um',
33-
'categoria', 'note', 'magazzino', 'giacenza_iniziale', ];
32+
$allowed = ['cod', 'nome', 'desc', 'prezzo_ivato', 'prezzo_netto', 'prezzo_lordo', 'costo', 'cod_iva', 'um', 'categoria', 'note', 'magazzino', 'giacenza_iniziale'];
3433

3534
$required = ['nome'];
3635

@@ -46,8 +45,7 @@ public static function nuovo($data = [])
4645
*/
4746
public static function importa($type, $data = [])
4847
{
49-
$allowed = ['cod', 'nome', 'desc', 'prezzo_ivato', 'prezzo_netto', 'prezzo_lordo', 'costo', 'cod_iva', 'um',
50-
'categoria', 'note', 'magazzino', 'giacenza_iniziale', ];
48+
$allowed = ['cod', 'nome', 'desc', 'prezzo_ivato', 'prezzo_netto', 'prezzo_lordo', 'costo', 'cod_iva', 'um', 'categoria', 'note', 'magazzino', 'giacenza_iniziale'];
5149

5250
$required = ['nome'];
5351

@@ -66,8 +64,7 @@ public static function importa($type, $data = [])
6664
*/
6765
public static function modifica($data = [])
6866
{
69-
$allowed = ['id', 'cod', 'nome', 'desc', 'prezzo_ivato', 'prezzo_netto', 'prezzo_lordo', 'costo', 'cod_iva', 'um',
70-
'categoria', 'note', 'magazzino', 'giacenza_iniziale', ];
67+
$allowed = ['id', 'cod', 'nome', 'desc', 'prezzo_ivato', 'prezzo_netto', 'prezzo_lordo', 'costo', 'cod_iva', 'um', 'categoria', 'note', 'magazzino', 'giacenza_iniziale'];
7168
$required = ['id'];
7269

7370
return Common::parseData($data, $allowed, $required);

0 commit comments

Comments
 (0)