@@ 10-57 (lines=48) @@ | ||
7 | use FLAIRUK\GoodTillSystem\Models\Sale; |
|
8 | use FLAIRUK\GoodTillSystem\Models\Product; |
|
9 | ||
10 | class Report extends API { |
|
11 | ||
12 | ||
13 | protected $url; |
|
14 | ||
15 | const SALE = 'sale'; |
|
16 | const PRODUCTS = 'products'; |
|
17 | const REPORT = 'report'; |
|
18 | ||
19 | /** |
|
20 | * Create a new GoodTill instance. |
|
21 | * |
|
22 | * @return void |
|
23 | */ |
|
24 | public function __construct($user) |
|
25 | { |
|
26 | $this->user = $user; |
|
27 | ||
28 | parent::__construct($user, $this->url); |
|
29 | } |
|
30 | ||
31 | public function setURL(): void { |
|
32 | $this->url = Config::get('goodtill.routes.api') . self::REPORT . '/'; |
|
33 | } |
|
34 | ||
35 | /** |
|
36 | * External Products |
|
37 | * |
|
38 | * @return Product |
|
39 | */ |
|
40 | public function products(): Product { |
|
41 | $sale = new Product($this->user); |
|
42 | $sale->setURL($this->url . self::PRODUCTS . '/'); |
|
43 | return $sale; |
|
44 | } |
|
45 | ||
46 | public function sale($id = null): Sale { |
|
47 | $sale = new Sale($this->user); |
|
48 | $sale->setURL($this->url . self::SALE . '/' . $id ?? $id); |
|
49 | return $sale; |
|
50 | ||
51 | } |
|
52 | ||
53 | public function status() { |
|
54 | $this->url = $this->url . self::SALE . '/'; |
|
55 | return $this; |
|
56 | } |
|
57 | } |
|
58 |
@@ 10-57 (lines=48) @@ | ||
7 | use FLAIRUK\GoodTillSystem\Models\Sale; |
|
8 | use FLAIRUK\GoodTillSystem\Models\Product; |
|
9 | ||
10 | class ExternalSale extends API { |
|
11 | ||
12 | protected $url; |
|
13 | ||
14 | const SALE = 'sale'; |
|
15 | const PRODUCTS = 'products'; |
|
16 | const EXTERNAL_SALE = 'external_sale'; |
|
17 | ||
18 | /** |
|
19 | * Create a new GoodTill instance. |
|
20 | * |
|
21 | * @return void |
|
22 | */ |
|
23 | public function __construct($user) |
|
24 | { |
|
25 | $this->user = $user; |
|
26 | ||
27 | parent::__construct($user, $this->url); |
|
28 | } |
|
29 | ||
30 | public function setURL(): void { |
|
31 | $this->url = Config::get('goodtill.routes.api') . self::EXTERNAL_SALE . '/'; |
|
32 | } |
|
33 | ||
34 | /** |
|
35 | * External Products |
|
36 | * |
|
37 | * @return Product |
|
38 | */ |
|
39 | public function products(): Product { |
|
40 | $product = new Product($this->user); |
|
41 | $product->setURL($this->url . self::PRODUCTS); |
|
42 | return $product; |
|
43 | } |
|
44 | ||
45 | public function sale($id = null): Sale { |
|
46 | $sale = new Sale($this->user); |
|
47 | $sale->setURL($this->url . self::SALE . '/' . $id ?? $id); |
|
48 | return $sale; |
|
49 | ||
50 | } |
|
51 | ||
52 | public function status() { |
|
53 | $this->url = $this->url . self::SALE . '/'; |
|
54 | return $this; |
|
55 | } |
|
56 | ||
57 | } |