2
2
3
3
namespace Codexshaper \WooCommerce \Models ;
4
4
5
+ use Codexshaper \WooCommerce \Facades \Query ;
5
6
use Codexshaper \WooCommerce \Traits \QueryBuilderTrait ;
6
7
7
8
class Attribute extends BaseModel
@@ -20,9 +21,9 @@ class Attribute extends BaseModel
20
21
*/
21
22
protected function getTerms ($ attribute_id , $ options = [])
22
23
{
23
- $ this -> endpoint = " products/attributes/ { $ attribute_id } /terms " ;
24
-
25
- return self :: all ($ options );
24
+ return Query:: init ()
25
+ -> setEndpoint ( " products/attributes/ { $ attribute_id } /terms " )
26
+ -> all ($ options );
26
27
}
27
28
28
29
/**
@@ -36,9 +37,9 @@ protected function getTerms($attribute_id, $options = [])
36
37
*/
37
38
protected function getTerm ($ attribute_id , $ term_id , $ options = [])
38
39
{
39
- $ this -> endpoint = " products/attributes/ { $ attribute_id } /terms " ;
40
-
41
- return self :: find ($ term_id , $ options );
40
+ return Query:: init ()
41
+ -> setEndpoint ( " products/attributes/ { $ attribute_id } /terms " )
42
+ -> find ($ term_id , $ options );
42
43
}
43
44
44
45
/**
@@ -51,9 +52,9 @@ protected function getTerm($attribute_id, $term_id, $options = [])
51
52
*/
52
53
protected function addTerm ($ attribute_id , $ data )
53
54
{
54
- $ this -> endpoint = " products/attributes/ { $ attribute_id } /terms " ;
55
-
56
- return self :: create ($ data );
55
+ return Query:: init ()
56
+ -> setEndpoint ( " products/attributes/ { $ attribute_id } /terms " )
57
+ -> create ($ data );
57
58
}
58
59
59
60
/**
@@ -67,9 +68,9 @@ protected function addTerm($attribute_id, $data)
67
68
*/
68
69
protected function updateTerm ($ attribute_id , $ term_id , $ data )
69
70
{
70
- $ this -> endpoint = " products/attributes/ { $ attribute_id } /terms " ;
71
-
72
- return self :: update ($ term_id , $ data );
71
+ return Query:: init ()
72
+ -> setEndpoint ( " products/attributes/ { $ attribute_id } /terms " )
73
+ -> update ($ term_id , $ data );
73
74
}
74
75
75
76
/**
@@ -83,9 +84,9 @@ protected function updateTerm($attribute_id, $term_id, $data)
83
84
*/
84
85
protected function deleteTerm ($ attribute_id , $ term_id , $ options = [])
85
86
{
86
- $ this -> endpoint = " products/attributes/ { $ attribute_id } /terms " ;
87
-
88
- return self :: delete ($ term_id , $ options );
87
+ return Query:: init ()
88
+ -> setEndpoint ( " products/attributes/ { $ attribute_id } /terms " )
89
+ -> delete ($ term_id , $ options );
89
90
}
90
91
91
92
/**
@@ -98,8 +99,8 @@ protected function deleteTerm($attribute_id, $term_id, $options = [])
98
99
*/
99
100
protected function batchTerm ($ attribute_id , $ data )
100
101
{
101
- $ this -> endpoint = " products/attributes/ { $ attribute_id } /terms " ;
102
-
103
- return self :: batch ($ data );
102
+ $ return Query:: init ()
103
+ -> setEndpoint ( " products/attributes/ { $ attribute_id } /terms " )
104
+ -> batch ($ data );
104
105
}
105
106
}
0 commit comments