@@ -20,7 +20,7 @@ |
||
20 | 20 | public function selectOneByShopIdAndId($shopId, $sendingMethodId) |
21 | 21 | { |
22 | 22 | return $this->model->with( |
23 | - array('relatedPaymentMethods' => function ($query) { |
|
23 | + array('relatedPaymentMethods' => function($query) { |
|
24 | 24 | $query->where('active', 1); |
25 | 25 | }) |
26 | 26 | )->where('shop_id', $shopId)->where('active', 1) |
@@ -20,10 +20,10 @@ |
||
20 | 20 | |
21 | 21 | public function selectBySendingMethodIdAndPaymentMethodId($paymentMethodId, $sendingMethodId) |
22 | 22 | { |
23 | - $result = $this->model->with(array('sendingPaymentMethodRelated' => function ($query) use ($paymentMethodId, $sendingMethodId) { |
|
24 | - $query->with(array('sendingMethod' => function ($query) use ($sendingMethodId) { |
|
23 | + $result = $this->model->with(array('sendingPaymentMethodRelated' => function($query) use ($paymentMethodId, $sendingMethodId) { |
|
24 | + $query->with(array('sendingMethod' => function($query) use ($sendingMethodId) { |
|
25 | 25 | $query->where('id', $sendingMethodId); |
26 | - }, 'paymentMethod' => function ($query) use ($paymentMethodId) { |
|
26 | + }, 'paymentMethod' => function($query) use ($paymentMethodId) { |
|
27 | 27 | $query->where('id', $paymentMethodId); |
28 | 28 | })); |
29 | 29 | } )) |
@@ -75,7 +75,7 @@ |
||
75 | 75 | |
76 | 76 | public function orderProductsByClientId($clientId, $shopId) |
77 | 77 | { |
78 | - return $this->modelOrderProduct->with(array('product'))->whereHas('Order', function ($query) use ($clientId, $shopId) { |
|
78 | + return $this->modelOrderProduct->with(array('product'))->whereHas('Order', function($query) use ($clientId, $shopId) { |
|
79 | 79 | $query->where('client_id', '=', $clientId)->where('shop_id', $shopId); |
80 | 80 | }); |
81 | 81 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $result = $this->model->where('id', '=', $parentId)->first()->children() |
59 | 59 | ->with( |
60 | - array('productCategoryImages' => function ($query) use ($imageTag) { |
|
60 | + array('productCategoryImages' => function($query) use ($imageTag) { |
|
61 | 61 | if ($imageTag) { |
62 | 62 | $query->where('tag', '=', $imageTag); |
63 | 63 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | $result = $this->model |
82 | 82 | ->with( |
83 | - array('productCategoryImages' => function ($query) use ($imageTag) { |
|
83 | + array('productCategoryImages' => function($query) use ($imageTag) { |
|
84 | 84 | if ($imageTag) { |
85 | 85 | $query->where('tag', '=', $imageTag); |
86 | 86 | } |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | $result = $this->model-> |
120 | 120 | with( |
121 | 121 | array( |
122 | - 'products' => function ($query) { |
|
122 | + 'products' => function($query) { |
|
123 | 123 | $query->where('active', 1)->with( |
124 | - array('productImages' => function ($query) { |
|
124 | + array('productImages' => function($query) { |
|
125 | 125 | $query->orderBy('rank', 'asc'); |
126 | 126 | }) |
127 | 127 | ); |
128 | 128 | }, |
129 | - 'productCategoryImages' => function ($query) use ($imageTag) { |
|
129 | + 'productCategoryImages' => function($query) use ($imageTag) { |
|
130 | 130 | if ($imageTag) { |
131 | 131 | $query->where('tag', '=', $imageTag); |
132 | 132 | } $query->orderBy('rank', 'asc'); |
@@ -32,10 +32,10 @@ |
||
32 | 32 | return $this->model->select('extra_field.*') |
33 | 33 | ->leftJoin('product_category_related_extra_field', 'extra_field.id', '=', 'product_category_related_extra_field.extra_field_id') |
34 | 34 | |
35 | - ->where(function ($query) use ($productCategoryId) { |
|
35 | + ->where(function($query) use ($productCategoryId) { |
|
36 | 36 | |
37 | 37 | $query->where('all_products', 1) |
38 | - ->orWhereHas('categories', function ($query) use ($productCategoryId) { |
|
38 | + ->orWhereHas('categories', function($query) use ($productCategoryId) { |
|
39 | 39 | |
40 | 40 | $query->where('product_category_id', $productCategoryId); |
41 | 41 | }); |
@@ -18,8 +18,8 @@ |
||
18 | 18 | |
19 | 19 | function selectAllByTagAndShopId($shopId, $tag) |
20 | 20 | { |
21 | - $result = $this->model->with(array('relatedProducts' => function ($query) { |
|
22 | - $query->with(array('productCategory', 'productImages' => function ($query) { |
|
21 | + $result = $this->model->with(array('relatedProducts' => function($query) { |
|
22 | + $query->with(array('productCategory', 'productImages' => function($query) { |
|
23 | 23 | $query->orderBy('rank', 'asc'); |
24 | 24 | }))->where('active', 1); |
25 | 25 | }))->where('shop_id', $shopId)->where('tag', '=', $tag)->get(); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | public function selectByLimitAndOrderBy($shopId, $limit, $orderBy) |
28 | 28 | { |
29 | - return $this->model->with(array('productCategory', 'relatedProducts', 'productImages' => function ($query) { |
|
29 | + return $this->model->with(array('productCategory', 'relatedProducts', 'productImages' => function($query) { |
|
30 | 30 | $query->orderBy('rank', 'asc'); |
31 | 31 | }))->where('shop_id', $shopId)->where('active', 1)->limit($limit)->orderBy('id', $orderBy)->get(); |
32 | 32 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | public function selectAllExport() |
40 | 40 | { |
41 | - return $this->model->with(array('productImages' => function ($query) { |
|
41 | + return $this->model->with(array('productImages' => function($query) { |
|
42 | 42 | $query->orderBy('rank', 'asc'); |
43 | 43 | }))->where('active', 1)->where('shop_id', auth('hideyobackend')->user()->selected_shop_id)->get(); |
44 | 44 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | public function selectOneById($productId) |
74 | 74 | { |
75 | - $result = $this->model->with(array('productCategory', 'relatedProducts', 'productImages' => function ($query) { |
|
75 | + $result = $this->model->with(array('productCategory', 'relatedProducts', 'productImages' => function($query) { |
|
76 | 76 | $query->orderBy('rank', 'asc'); |
77 | 77 | }))->where('active', 1)->where('id', '=', $productId)->get()->first(); |
78 | 78 | return $result; |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | function selectAllByShopIdAndProductCategoryId($shopId, $productCategoryId, $filters = false) |
94 | 94 | { |
95 | 95 | $result = $this->model |
96 | - ->with(array('subcategories', 'extraFields' => function ($query) { |
|
96 | + ->with(array('subcategories', 'extraFields' => function($query) { |
|
97 | 97 | $query->with('extraField')->orderBy('id', 'desc'); |
98 | - }, 'taxRate', 'productCategory', 'relatedProducts' => function ($query) { |
|
98 | + }, 'taxRate', 'productCategory', 'relatedProducts' => function($query) { |
|
99 | 99 | $query->with('productImages')->orderBy('rank', 'asc'); |
100 | - }, 'productImages' => function ($query) { |
|
100 | + }, 'productImages' => function($query) { |
|
101 | 101 | $query->orderBy('rank', 'asc'); |
102 | 102 | })) |
103 | 103 | ->where('shop_id', $shopId) |
104 | 104 | ->where('active', 1) |
105 | 105 | ->whereNotNull('product.product_category_id') |
106 | - ->where(function ($query) use ($productCategoryId) { |
|
106 | + ->where(function($query) use ($productCategoryId) { |
|
107 | 107 | $query->where('product_category_id', '=', $productCategoryId); |
108 | - $query->orWhereHas('subcategories', function ($query) use ($productCategoryId) { |
|
108 | + $query->orWhereHas('subcategories', function($query) use ($productCategoryId) { |
|
109 | 109 | $query->where('product_category_id', '=', $productCategoryId); |
110 | 110 | }); |
111 | 111 | }); |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | return $this->model->with( |
121 | 121 | array( |
122 | 122 | 'attributeGroup', |
123 | - 'attributes' => function ($query) { |
|
123 | + 'attributes' => function($query) { |
|
124 | 124 | $query->with( |
125 | 125 | array( |
126 | - 'combinations' => function ($query) { |
|
126 | + 'combinations' => function($query) { |
|
127 | 127 | $query->with( |
128 | 128 | array( |
129 | 129 | 'productAttribute', |
130 | - 'attribute' => function ($query) { |
|
130 | + 'attribute' => function($query) { |
|
131 | 131 | $query->with( |
132 | 132 | array( |
133 | 133 | 'attributeGroup' |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | ) |
141 | 141 | )->orderBy('default_on', 'desc'); |
142 | 142 | }, |
143 | - 'extraFields' => function ($query) { |
|
143 | + 'extraFields' => function($query) { |
|
144 | 144 | $query->where( |
145 | 145 | 'value', |
146 | 146 | '!=', |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | 'desc' |
152 | 152 | ); |
153 | 153 | }, |
154 | - 'relatedProducts' => function ($query) { |
|
154 | + 'relatedProducts' => function($query) { |
|
155 | 155 | $query->with( |
156 | 156 | 'productImages', |
157 | 157 | 'productCategory' |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | 'asc' |
161 | 161 | ); |
162 | 162 | }, |
163 | - 'productImages' => function ($query) { |
|
163 | + 'productImages' => function($query) { |
|
164 | 164 | $query->orderBy( |
165 | 165 | 'rank', |
166 | 166 | 'asc' |
@@ -174,31 +174,31 @@ discard block |
||
174 | 174 | { |
175 | 175 | $images = array(); |
176 | 176 | |
177 | - if($product->productImages->count()) { |
|
177 | + if ($product->productImages->count()) { |
|
178 | 178 | |
179 | 179 | $images = $product->productImages()->has('relatedAttributes', '=', 0)->has('relatedProductAttributes', '=', 0)->orderBy('rank', '=', 'asc')->get(); |
180 | 180 | |
181 | - if($combinationsIds) { |
|
181 | + if ($combinationsIds) { |
|
182 | 182 | |
183 | 183 | $imagesRelatedAttributes = ProductImage:: |
184 | 184 | whereHas('relatedAttributes', function($query) use ($combinationsIds, $product) { $query->with(array('productImage'))->whereIn('attribute_id', $combinationsIds); }) |
185 | 185 | ->where('product_id', '=', $product->id) |
186 | 186 | ->get(); |
187 | 187 | |
188 | - if($imagesRelatedAttributes) { |
|
188 | + if ($imagesRelatedAttributes) { |
|
189 | 189 | $images = $images->merge($imagesRelatedAttributes)->sortBy('rank'); |
190 | 190 | } |
191 | 191 | |
192 | 192 | } |
193 | 193 | |
194 | - if($productAttributeId) { |
|
194 | + if ($productAttributeId) { |
|
195 | 195 | |
196 | 196 | $imagesRelatedProductAttributes = ProductImage:: |
197 | 197 | whereHas('relatedProductAttributes', function($query) use ($productAttributeId, $product) { $query->where('product_attribute_id', '=', $productAttributeId); }) |
198 | 198 | ->where('product_id', '=', $product->id) |
199 | 199 | ->get(); |
200 | 200 | |
201 | - if($imagesRelatedProductAttributes) { |
|
201 | + if ($imagesRelatedProductAttributes) { |
|
202 | 202 | $images = $images->merge($imagesRelatedProductAttributes)->sortBy('rank'); |
203 | 203 | } |
204 | 204 |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | |
31 | 31 | public function selectAllByShopIdAndProductId($shopId, $productId) |
32 | 32 | { |
33 | - return $this->model->select('id')->where('product_id', '=', $productId)->with(array('combinations' => function ($query) { |
|
34 | - $query->with(array('attribute' => function ($query) { |
|
33 | + return $this->model->select('id')->where('product_id', '=', $productId)->with(array('combinations' => function($query) { |
|
34 | + $query->with(array('attribute' => function($query) { |
|
35 | 35 | $query->with(array('attributeGroup')); |
36 | 36 | })); |
37 | 37 | }))->get(); |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | public function selectAllByProductCategoryId($productCategoryId, $shopId) |
69 | 69 | { |
70 | 70 | return $this->model-> |
71 | - whereHas('product', function ($query) use ($productCategoryId, $shopId) { |
|
71 | + whereHas('product', function($query) use ($productCategoryId, $shopId) { |
|
72 | 72 | $query->where('product_category_id', '=', $productCategoryId); |
73 | 73 | $query->where('active', 1); |
74 | 74 | $query->where('shop_id', $shopId); |
75 | - })->with(array('combinations' => function ($q) { |
|
76 | - $q->with(array('attribute' => function ($q) { |
|
75 | + })->with(array('combinations' => function($q) { |
|
76 | + $q->with(array('attribute' => function($q) { |
|
77 | 77 | $q->with(array('attributeGroup')); |
78 | 78 | })); |
79 | 79 | }))->get(); |
@@ -115,18 +115,18 @@ discard block |
||
115 | 115 | |
116 | 116 | function getProductAttribute($product, $productAttributeId, $secondAttributeId = false) { |
117 | 117 | $productAttribute = $this->model->where('product_id', '=', $product->id) |
118 | - ->whereHas('combinations', function ($query) use ($productAttributeId, $secondAttributeId) { |
|
118 | + ->whereHas('combinations', function($query) use ($productAttributeId, $secondAttributeId) { |
|
119 | 119 | if ($productAttributeId) { |
120 | 120 | $query->where('attribute_id', '=', $productAttributeId); |
121 | 121 | } |
122 | 122 | }) |
123 | - ->whereHas('combinations', function ($query) use ($secondAttributeId) { |
|
123 | + ->whereHas('combinations', function($query) use ($secondAttributeId) { |
|
124 | 124 | if ($secondAttributeId) { |
125 | 125 | $query->where('attribute_id', '=', $secondAttributeId); |
126 | 126 | } |
127 | 127 | }) |
128 | - ->with(array('combinations' => function ($query) { |
|
129 | - $query->with(array('attribute' => function ($query) { |
|
128 | + ->with(array('combinations' => function($query) { |
|
129 | + $query->with(array('attribute' => function($query) { |
|
130 | 130 | $query->with(array('attributeGroup')); |
131 | 131 | })); |
132 | 132 | })) |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ); |
30 | 30 | |
31 | 31 | if ($AmountOptionId) { |
32 | - $rules['amount'] = 'required'; |
|
32 | + $rules['amount'] = 'required'; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | return $rules; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | function selectOneByShopIdAndId($shopId, $AmountOptionId) |
82 | 82 | { |
83 | - $result = $this->model->with(array('relatedPaymentMethods' => function ($query) { |
|
83 | + $result = $this->model->with(array('relatedPaymentMethods' => function($query) { |
|
84 | 84 | $query->where('active', 1); |
85 | 85 | }))->where('shop_id', $shopId)->where('active', 1)->where('id', '=', $AmountOptionId)->get(); |
86 | 86 |