File tree Expand file tree Collapse file tree 5 files changed +53
-113
lines changed Expand file tree Collapse file tree 5 files changed +53
-113
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ WooCommerce Rest API with Laravel
4
4
#Install
5
5
6
6
```
7
- composer require codexshaper/laravel- woocommerce
7
+ composer require codexshaper/woocommerce
8
8
```
9
9
10
10
#Publish config file
Original file line number Diff line number Diff line change @@ -10,34 +10,4 @@ class Customer
10
10
use QueryBuilderTrait;
11
11
12
12
protected $ endpoint = 'customers ' ;
13
-
14
- public function all ($ options = [])
15
- {
16
- return WooCommerce::all ('customers ' , $ options );
17
- }
18
-
19
- public function find ($ id , $ options = [])
20
- {
21
- return WooCommerce::find ("customers/ {$ id }" , $ options );
22
- }
23
-
24
- public function create ($ data )
25
- {
26
- return WooCommerce::create ('customers ' , $ data );
27
- }
28
-
29
- public function update ($ id , $ data )
30
- {
31
- return WooCommerce::update ("customers/ {$ id }" , $ data );
32
- }
33
-
34
- public function delete ($ id , $ options = [])
35
- {
36
- return WooCommerce::delete ("customers/ {$ id }" , $ options );
37
- }
38
-
39
- public function batch ($ data )
40
- {
41
- return WooCommerce::create ('customers/batch ' , $ options );
42
- }
43
13
}
Original file line number Diff line number Diff line change @@ -11,36 +11,6 @@ class Order
11
11
12
12
protected $ endpoint = 'orders ' ;
13
13
14
- public function all ($ options = [])
15
- {
16
- return WooCommerce::all ('orders ' , $ options );
17
- }
18
-
19
- public function find ($ id , $ options = [])
20
- {
21
- return collect (WooCommerce::find ("orders/ {$ id }" , $ options ));
22
- }
23
-
24
- public function create ($ data )
25
- {
26
- return WooCommerce::create ('orders ' , $ data );
27
- }
28
-
29
- public function update ($ id , $ data )
30
- {
31
- return WooCommerce::update ("orders/ {$ id }" , $ data );
32
- }
33
-
34
- public function delete ($ id , $ options = [])
35
- {
36
- return WooCommerce::delete ("orders/ {$ id }" , $ options );
37
- }
38
-
39
- public function batch ($ data )
40
- {
41
- return WooCommerce::create ('orders/batch ' , $ data );
42
- }
43
-
44
14
/*
45
15
* Note
46
16
*/
Original file line number Diff line number Diff line change @@ -10,56 +10,4 @@ class Product
10
10
use QueryBuilderTrait;
11
11
12
12
protected $ endpoint = 'products ' ;
13
-
14
- /**
15
- * Retrieve all products
16
- *
17
- * @param array $options
18
- *
19
- * @return array
20
- */
21
- public function all ($ options = [])
22
- {
23
- return WooCommerce::all ('products ' , $ options );
24
- }
25
-
26
- /**
27
- * Retrieve single product
28
- *
29
- * @param integer $id
30
- * @param array $options
31
- *
32
- * @return object
33
- */
34
- public function find ($ id , $ options = [])
35
- {
36
- return collect (WooCommerce::find ("products/ {$ id }" , $ options ));
37
- }
38
-
39
- /**
40
- * Create new product
41
- *
42
- * @param array $data
43
- *
44
- * @return object
45
- */
46
- public function create ($ data )
47
- {
48
- return WooCommerce::create ('products ' , $ data );
49
- }
50
-
51
- public function update ($ id , $ data )
52
- {
53
- return WooCommerce::update ("products/ {$ id }" , $ data );
54
- }
55
-
56
- public function delete ($ id , $ options = [])
57
- {
58
- return WooCommerce::delete ("products/ {$ id }" , $ options );
59
- }
60
-
61
- public function batch ($ data )
62
- {
63
- return WooCommerce::create ('products/batch ' , $ options );
64
- }
65
13
}
Original file line number Diff line number Diff line change @@ -11,6 +11,58 @@ trait QueryBuilderTrait
11
11
*/
12
12
protected $ options = [];
13
13
14
+ /**
15
+ * Retrieve all products
16
+ *
17
+ * @param array $options
18
+ *
19
+ * @return array
20
+ */
21
+ public function all ($ options = [])
22
+ {
23
+ return WooCommerce::all ($ this ->endpoint , $ options );
24
+ }
25
+
26
+ /**
27
+ * Retrieve single product
28
+ *
29
+ * @param integer $id
30
+ * @param array $options
31
+ *
32
+ * @return object
33
+ */
34
+ public function find ($ id , $ options = [])
35
+ {
36
+ return collect (WooCommerce::find ("{$ this ->endpoint }/ {$ id }" , $ options ));
37
+ }
38
+
39
+ /**
40
+ * Create new product
41
+ *
42
+ * @param array $data
43
+ *
44
+ * @return object
45
+ */
46
+ public function create ($ data )
47
+ {
48
+ return WooCommerce::create ($ this ->endpoint , $ data );
49
+ }
50
+
51
+ public function update ($ id , $ data )
52
+ {
53
+ return WooCommerce::update ("{$ this ->endpoint }/ {$ id }" , $ data );
54
+ }
55
+
56
+ public function delete ($ id , $ options = [])
57
+ {
58
+ return WooCommerce::delete ("{$ this ->endpoint }/ {$ id }" , $ options );
59
+ }
60
+
61
+ public function batch ($ data )
62
+ {
63
+ return WooCommerce::create ('{$this->endpoint}/batch ' , $ options );
64
+ }
65
+
14
66
/**
15
67
* Retrieve data
16
68
*
You can’t perform that action at this time.
0 commit comments