22
33namespace Codexshaper \WooCommerce \Models ;
44
5+ use Codexshaper \WooCommerce \Facades \Query ;
56use Codexshaper \WooCommerce \Traits \QueryBuilderTrait ;
67
78class Attribute extends BaseModel
@@ -20,9 +21,9 @@ class Attribute extends BaseModel
2021 */
2122 protected function getTerms ($ attribute_id , $ options = [])
2223 {
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 );
2627 }
2728
2829 /**
@@ -36,9 +37,9 @@ protected function getTerms($attribute_id, $options = [])
3637 */
3738 protected function getTerm ($ attribute_id , $ term_id , $ options = [])
3839 {
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 );
4243 }
4344
4445 /**
@@ -51,9 +52,9 @@ protected function getTerm($attribute_id, $term_id, $options = [])
5152 */
5253 protected function addTerm ($ attribute_id , $ data )
5354 {
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 );
5758 }
5859
5960 /**
@@ -67,9 +68,9 @@ protected function addTerm($attribute_id, $data)
6768 */
6869 protected function updateTerm ($ attribute_id , $ term_id , $ data )
6970 {
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 );
7374 }
7475
7576 /**
@@ -83,9 +84,9 @@ protected function updateTerm($attribute_id, $term_id, $data)
8384 */
8485 protected function deleteTerm ($ attribute_id , $ term_id , $ options = [])
8586 {
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 );
8990 }
9091
9192 /**
@@ -98,8 +99,8 @@ protected function deleteTerm($attribute_id, $term_id, $options = [])
9899 */
99100 protected function batchTerm ($ attribute_id , $ data )
100101 {
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 );
104105 }
105106}
0 commit comments