@@ -186,8 +186,10 @@ discard block |
||
| 186 | 186 | $origin_state = $this->setting->first()->state; //Get the State of origin |
| 187 | 187 | $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray(); |
| 188 | 188 | |
| 189 | - if ($tax_class_id) {//If the product is allowed for tax (Check in tax_product relation table) |
|
| 190 | - if ($tax_enable == 1) {//If GST is Enabled |
|
| 189 | + if ($tax_class_id) { |
|
| 190 | +//If the product is allowed for tax (Check in tax_product relation table) |
|
| 191 | + if ($tax_enable == 1) { |
|
| 192 | +//If GST is Enabled |
|
| 191 | 193 | |
| 192 | 194 | $state_code = ''; |
| 193 | 195 | $c_gst = ''; |
@@ -198,45 +200,52 @@ discard block |
||
| 198 | 200 | $rate = ''; |
| 199 | 201 | $status = 1; |
| 200 | 202 | |
| 201 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 203 | + if ($user_state != '') { |
|
| 204 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 202 | 205 | $c_gst = $user_state->c_gst; |
| 203 | 206 | $s_gst = $user_state->s_gst; |
| 204 | 207 | $i_gst = $user_state->i_gst; |
| 205 | 208 | $ut_gst = $user_state->ut_gst; |
| 206 | 209 | $state_code = $user_state->state_code; |
| 207 | 210 | |
| 208 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 211 | + if ($state_code == $origin_state) { |
|
| 212 | +//If user and origin state are same |
|
| 209 | 213 | $rateForSameState = $this->getTaxWhenIndianSameState($user_state, |
| 210 | 214 | $origin_state, $productid, $c_gst, $s_gst, $state_code, $status); |
| 211 | 215 | |
| 212 | 216 | $taxes = $rateForSameState['taxes']; |
| 213 | 217 | $status = $rateForSameState['status']; |
| 214 | 218 | $value = $rateForSameState['value']; |
| 215 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 219 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') { |
|
| 220 | +//If user is from other state |
|
| 216 | 221 | $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, |
| 217 | 222 | $origin_state, $productid, $i_gst, $state_code, $status); |
| 218 | 223 | $taxes = $rateForOtherState['taxes']; |
| 219 | 224 | $status = $rateForOtherState['status']; |
| 220 | 225 | $value = $rateForOtherState['value']; |
| 221 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 226 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') { |
|
| 227 | +//if user from Union Territory |
|
| 222 | 228 | $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, |
| 223 | 229 | $origin_state, $productid, $c_gst, $ut_gst, $state_code, $status); |
| 224 | 230 | $taxes = $rateForUnionTerritory['taxes']; |
| 225 | 231 | $status = $rateForUnionTerritory['status']; |
| 226 | 232 | $value = $rateForUnionTerritory['value']; |
| 227 | 233 | } |
| 228 | - } else {//If user from other Country |
|
| 234 | + } else { |
|
| 235 | +//If user from other Country |
|
| 229 | 236 | $taxClassId = Tax::where('state', $geoip_state) |
| 230 | 237 | ->orWhere('country', $geoip_country) |
| 231 | 238 | ->pluck('tax_classes_id')->first(); |
| 232 | - if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 239 | + if ($taxClassId) { |
|
| 240 | +//if state equals the user State or country equals user country |
|
| 233 | 241 | $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, |
| 234 | 242 | $productid, $status); |
| 235 | 243 | $taxes = $taxForSpecificCountry['taxes']; |
| 236 | 244 | $status = $taxForSpecificCountry['status']; |
| 237 | 245 | $value = $taxForSpecificCountry['value']; |
| 238 | 246 | $rate = $taxForSpecificCountry['value']; |
| 239 | - } else {//if Tax is selected for Any Country Any State |
|
| 247 | + } else { |
|
| 248 | +//if Tax is selected for Any Country Any State |
|
| 240 | 249 | $taxClassId = Tax::where('country', '') |
| 241 | 250 | ->where('state', 'Any State') |
| 242 | 251 | ->pluck('tax_classes_id')->first(); |
@@ -277,7 +286,8 @@ discard block |
||
| 277 | 286 | ]); |
| 278 | 287 | } |
| 279 | 288 | } |
| 280 | - } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 289 | + } elseif ($tax_enable == 0) { |
|
| 290 | +//If Tax enable is 0 |
|
| 281 | 291 | $status = 1; |
| 282 | 292 | if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
| 283 | 293 | $taxClassId = Tax::where('country', '') |
@@ -300,13 +310,15 @@ discard block |
||
| 300 | 310 | 'value' => $value, |
| 301 | 311 | ]); |
| 302 | 312 | } |
| 303 | - } else {//In case of other country |
|
| 313 | + } else { |
|
| 314 | +//In case of other country |
|
| 304 | 315 | //when tax is available and tax is not enabled |
| 305 | 316 | //(Applicable when Global Tax class for any country and state is not there) |
| 306 | 317 | $taxClassId = Tax::where('state', $geoip_state) |
| 307 | 318 | ->orWhere('country', $geoip_country) |
| 308 | 319 | ->pluck('tax_classes_id')->first(); |
| 309 | - if ($taxClassId) { //if state equals the user State |
|
| 320 | + if ($taxClassId) { |
|
| 321 | +//if state equals the user State |
|
| 310 | 322 | $taxes = $this->getTaxByPriority($taxClassId); |
| 311 | 323 | $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
| 312 | 324 | if ($value == '') { |
@@ -192,149 +192,149 @@ discard block |
||
| 192 | 192 | $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray(); |
| 193 | 193 | |
| 194 | 194 | if ($tax_class_id) {//If the product is allowed for tax (Check in tax_product relation table) |
| 195 | - if ($tax_enable == 1) {//If GST is Enabled |
|
| 196 | - |
|
| 197 | - $state_code = ''; |
|
| 198 | - $c_gst = ''; |
|
| 199 | - $s_gst = ''; |
|
| 200 | - $i_gst = ''; |
|
| 201 | - $ut_gst = ''; |
|
| 202 | - $value = ''; |
|
| 203 | - $rate = ''; |
|
| 204 | - $status = 1; |
|
| 205 | - |
|
| 206 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 207 | - $c_gst = $user_state->c_gst; |
|
| 208 | - $s_gst = $user_state->s_gst; |
|
| 209 | - $i_gst = $user_state->i_gst; |
|
| 210 | - $ut_gst = $user_state->ut_gst; |
|
| 211 | - $state_code = $user_state->state_code; |
|
| 212 | - |
|
| 213 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 214 | - $rateForSameState = $this->getTaxWhenIndianSameState($user_state, |
|
| 195 | + if ($tax_enable == 1) {//If GST is Enabled |
|
| 196 | + |
|
| 197 | + $state_code = ''; |
|
| 198 | + $c_gst = ''; |
|
| 199 | + $s_gst = ''; |
|
| 200 | + $i_gst = ''; |
|
| 201 | + $ut_gst = ''; |
|
| 202 | + $value = ''; |
|
| 203 | + $rate = ''; |
|
| 204 | + $status = 1; |
|
| 205 | + |
|
| 206 | + if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 207 | + $c_gst = $user_state->c_gst; |
|
| 208 | + $s_gst = $user_state->s_gst; |
|
| 209 | + $i_gst = $user_state->i_gst; |
|
| 210 | + $ut_gst = $user_state->ut_gst; |
|
| 211 | + $state_code = $user_state->state_code; |
|
| 212 | + |
|
| 213 | + if ($state_code == $origin_state) {//If user and origin state are same |
|
| 214 | + $rateForSameState = $this->getTaxWhenIndianSameState($user_state, |
|
| 215 | 215 | $origin_state, $productid, $c_gst, $s_gst, $state_code, $status); |
| 216 | 216 | |
| 217 | - $taxes = $rateForSameState['taxes']; |
|
| 218 | - $status = $rateForSameState['status']; |
|
| 219 | - $value = $rateForSameState['value']; |
|
| 220 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 221 | - $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, |
|
| 217 | + $taxes = $rateForSameState['taxes']; |
|
| 218 | + $status = $rateForSameState['status']; |
|
| 219 | + $value = $rateForSameState['value']; |
|
| 220 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 221 | + $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, |
|
| 222 | 222 | $origin_state, $productid, $i_gst, $state_code, $status); |
| 223 | - $taxes = $rateForOtherState['taxes']; |
|
| 224 | - $status = $rateForOtherState['status']; |
|
| 225 | - $value = $rateForOtherState['value']; |
|
| 226 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 227 | - $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, |
|
| 223 | + $taxes = $rateForOtherState['taxes']; |
|
| 224 | + $status = $rateForOtherState['status']; |
|
| 225 | + $value = $rateForOtherState['value']; |
|
| 226 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 227 | + $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, |
|
| 228 | 228 | $origin_state, $productid, $c_gst, $ut_gst, $state_code, $status); |
| 229 | - $taxes = $rateForUnionTerritory['taxes']; |
|
| 230 | - $status = $rateForUnionTerritory['status']; |
|
| 231 | - $value = $rateForUnionTerritory['value']; |
|
| 232 | - } |
|
| 233 | - } else {//If user from other Country |
|
| 234 | - $taxClassId = Tax::where('state', $geoip_state) |
|
| 235 | - ->orWhere('country', $geoip_country) |
|
| 236 | - ->pluck('tax_classes_id')->first(); |
|
| 237 | - if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 238 | - $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, |
|
| 229 | + $taxes = $rateForUnionTerritory['taxes']; |
|
| 230 | + $status = $rateForUnionTerritory['status']; |
|
| 231 | + $value = $rateForUnionTerritory['value']; |
|
| 232 | + } |
|
| 233 | + } else {//If user from other Country |
|
| 234 | + $taxClassId = Tax::where('state', $geoip_state) |
|
| 235 | + ->orWhere('country', $geoip_country) |
|
| 236 | + ->pluck('tax_classes_id')->first(); |
|
| 237 | + if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 238 | + $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, |
|
| 239 | 239 | $productid, $status); |
| 240 | - $taxes = $taxForSpecificCountry['taxes']; |
|
| 241 | - $status = $taxForSpecificCountry['status']; |
|
| 242 | - $value = $taxForSpecificCountry['value']; |
|
| 243 | - $rate = $taxForSpecificCountry['value']; |
|
| 244 | - } else {//if Tax is selected for Any Country Any State |
|
| 245 | - $taxClassId = Tax::where('country', '') |
|
| 246 | - ->where('state', 'Any State') |
|
| 247 | - ->pluck('tax_classes_id')->first(); |
|
| 248 | - if ($taxClassId) { |
|
| 249 | - $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId, $productid, $status); |
|
| 250 | - $taxes = $taxForAnyCountry['taxes']; |
|
| 251 | - $status = $taxForAnyCountry['status']; |
|
| 252 | - $value = $taxForAnyCountry['value']; |
|
| 253 | - $rate = $taxForAnyCountry['value']; |
|
| 254 | - } else { |
|
| 255 | - $taxes = [0]; |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - } |
|
| 259 | - foreach ($taxes as $key => $tax) { |
|
| 240 | + $taxes = $taxForSpecificCountry['taxes']; |
|
| 241 | + $status = $taxForSpecificCountry['status']; |
|
| 242 | + $value = $taxForSpecificCountry['value']; |
|
| 243 | + $rate = $taxForSpecificCountry['value']; |
|
| 244 | + } else {//if Tax is selected for Any Country Any State |
|
| 245 | + $taxClassId = Tax::where('country', '') |
|
| 246 | + ->where('state', 'Any State') |
|
| 247 | + ->pluck('tax_classes_id')->first(); |
|
| 248 | + if ($taxClassId) { |
|
| 249 | + $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId, $productid, $status); |
|
| 250 | + $taxes = $taxForAnyCountry['taxes']; |
|
| 251 | + $status = $taxForAnyCountry['status']; |
|
| 252 | + $value = $taxForAnyCountry['value']; |
|
| 253 | + $rate = $taxForAnyCountry['value']; |
|
| 254 | + } else { |
|
| 255 | + $taxes = [0]; |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + foreach ($taxes as $key => $tax) { |
|
| 260 | 260 | |
| 261 | 261 | //All the da a attribute that is sent to the checkout Page if tax_compound=0 |
| 262 | - if ($taxes[0]) { |
|
| 263 | - $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, |
|
| 264 | - 's_gst' => $s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, |
|
| 262 | + if ($taxes[0]) { |
|
| 263 | + $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, |
|
| 264 | + 's_gst' => $s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, |
|
| 265 | 265 | 'state' => $state_code, 'origin_state'=>$origin_state, |
| 266 | - 'tax_enable' => $tax_enable, 'rate'=>$value, 'status'=>$status, ]; |
|
| 266 | + 'tax_enable' => $tax_enable, 'rate'=>$value, 'status'=>$status, ]; |
|
| 267 | 267 | |
| 268 | - $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 268 | + $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 269 | 269 | |
| 270 | 270 | 'name' => 'no compound', |
| 271 | 271 | 'type' => 'tax', |
| 272 | 272 | 'target' => 'item', |
| 273 | 273 | 'value' => $value, |
| 274 | - ]); |
|
| 275 | - } else { |
|
| 276 | - $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
|
| 277 | - $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 278 | - 'name' => 'null', |
|
| 279 | - 'type' => 'tax', |
|
| 280 | - 'target' => 'item', |
|
| 281 | - 'value' => '0%', |
|
| 282 | - ]); |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 286 | - $status = 1; |
|
| 287 | - if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
|
| 288 | - $taxClassId = Tax::where('country', '') |
|
| 289 | - ->where('state', 'Any State') |
|
| 290 | - ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 291 | - // other tax is available and tax is not enabled |
|
| 292 | - if ($taxClassId) { |
|
| 293 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 294 | - $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 295 | - if ($value == 0) { |
|
| 296 | - $status = 0; |
|
| 297 | - } |
|
| 298 | - $rate = $value; |
|
| 299 | - foreach ($taxes as $key => $tax) { |
|
| 300 | - $tax_attribute[$key] = ['name' => $tax->name, |
|
| 301 | - 'rate' => $value, 'tax_enable'=>0, 'status' => $status, ]; |
|
| 302 | - $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 274 | + ]); |
|
| 275 | + } else { |
|
| 276 | + $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
|
| 277 | + $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 278 | + 'name' => 'null', |
|
| 279 | + 'type' => 'tax', |
|
| 280 | + 'target' => 'item', |
|
| 281 | + 'value' => '0%', |
|
| 282 | + ]); |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 286 | + $status = 1; |
|
| 287 | + if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
|
| 288 | + $taxClassId = Tax::where('country', '') |
|
| 289 | + ->where('state', 'Any State') |
|
| 290 | + ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 291 | + // other tax is available and tax is not enabled |
|
| 292 | + if ($taxClassId) { |
|
| 293 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 294 | + $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 295 | + if ($value == 0) { |
|
| 296 | + $status = 0; |
|
| 297 | + } |
|
| 298 | + $rate = $value; |
|
| 299 | + foreach ($taxes as $key => $tax) { |
|
| 300 | + $tax_attribute[$key] = ['name' => $tax->name, |
|
| 301 | + 'rate' => $value, 'tax_enable'=>0, 'status' => $status, ]; |
|
| 302 | + $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 303 | 303 | |
| 304 | 304 | 'name' => $tax->name, |
| 305 | 305 | 'type' => 'tax', |
| 306 | 306 | 'target' => 'item', |
| 307 | 307 | 'value' => $value, |
| 308 | 308 | ]); |
| 309 | - } |
|
| 310 | - } else {//In case of other country |
|
| 311 | - //when tax is available and tax is not enabled |
|
| 312 | - //(Applicable when Global Tax class for any country and state is not there) |
|
| 313 | - $taxClassId = Tax::where('state', $geoip_state) |
|
| 314 | - ->orWhere('country', $geoip_country) |
|
| 315 | - ->pluck('tax_classes_id')->first(); |
|
| 316 | - if ($taxClassId) { //if state equals the user State |
|
| 317 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 318 | - $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 319 | - if ($value == '') { |
|
| 320 | - $status = 0; |
|
| 321 | - } |
|
| 322 | - $rate = $value; |
|
| 323 | - } |
|
| 324 | - foreach ($taxes as $key => $tax) { |
|
| 325 | - $tax_attribute[$key] = ['name' => $tax->name, |
|
| 326 | - 'rate' => $value, 'tax_enable'=>0, 'status' => $status, ]; |
|
| 327 | - $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 309 | + } |
|
| 310 | + } else {//In case of other country |
|
| 311 | + //when tax is available and tax is not enabled |
|
| 312 | + //(Applicable when Global Tax class for any country and state is not there) |
|
| 313 | + $taxClassId = Tax::where('state', $geoip_state) |
|
| 314 | + ->orWhere('country', $geoip_country) |
|
| 315 | + ->pluck('tax_classes_id')->first(); |
|
| 316 | + if ($taxClassId) { //if state equals the user State |
|
| 317 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 318 | + $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 319 | + if ($value == '') { |
|
| 320 | + $status = 0; |
|
| 321 | + } |
|
| 322 | + $rate = $value; |
|
| 323 | + } |
|
| 324 | + foreach ($taxes as $key => $tax) { |
|
| 325 | + $tax_attribute[$key] = ['name' => $tax->name, |
|
| 326 | + 'rate' => $value, 'tax_enable'=>0, 'status' => $status, ]; |
|
| 327 | + $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 328 | 328 | |
| 329 | 329 | 'name' => $tax->name, |
| 330 | 330 | 'type' => 'tax', |
| 331 | 331 | 'target' => 'item', |
| 332 | 332 | 'value' => $value, |
| 333 | 333 | ]); |
| 334 | - } |
|
| 335 | - } |
|
| 336 | - } |
|
| 337 | - } |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + } |
|
| 337 | + } |
|
| 338 | 338 | } else { |
| 339 | 339 | $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
| 340 | 340 | $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $value = ''; |
| 414 | 414 | $value = $taxes->toArray()[0]['active'] ? |
| 415 | 415 | (TaxProductRelation::where('product_id', $productid) |
| 416 | - ->where('tax_class_id', $taxClassId)->count() ? $ut_gst + $c_gst.'%' : 0) : 0; |
|
| 416 | + ->where('tax_class_id', $taxClassId)->count() ? $ut_gst + $c_gst.'%' : 0) : 0; |
|
| 417 | 417 | |
| 418 | 418 | return $value; |
| 419 | 419 | } |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $otherRate = 0; |
| 431 | 431 | $status = $taxes->toArray()[0]['active']; |
| 432 | 432 | if ($status && (TaxProductRelation::where('product_id', $productid) |
| 433 | - ->where('tax_class_id', $taxClassId)->count() > 0)) { |
|
| 433 | + ->where('tax_class_id', $taxClassId)->count() > 0)) { |
|
| 434 | 434 | $otherRate = Tax::where('tax_classes_id', $taxClassId)->first()->rate; |
| 435 | 435 | } |
| 436 | 436 | $value = $otherRate.'%'; |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | if ($subregion) { |
| 712 | 712 | $result = ['id' => $subregion->state_subdivision_code, |
| 713 | 713 | |
| 714 | - 'name' => $subregion->state_subdivision_name, ]; |
|
| 714 | + 'name' => $subregion->state_subdivision_name, ]; |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | return $result; |
@@ -30,29 +30,29 @@ |
||
| 30 | 30 | public function getPages() |
| 31 | 31 | { |
| 32 | 32 | return \DataTables::of($this->page->get()) |
| 33 | - ->addColumn('checkbox', function ($model) { |
|
| 33 | + ->addColumn('checkbox', function($model) { |
|
| 34 | 34 | return "<input type='checkbox' class='page_checkbox' |
| 35 | 35 | value=".$model->id.' name=select[] id=check>'; |
| 36 | 36 | }) |
| 37 | - ->addColumn('name', function ($model) { |
|
| 37 | + ->addColumn('name', function($model) { |
|
| 38 | 38 | return ucfirst($model->name); |
| 39 | 39 | }) |
| 40 | - ->addColumn('url', function ($model) { |
|
| 40 | + ->addColumn('url', function($model) { |
|
| 41 | 41 | return $model->url; |
| 42 | 42 | }) |
| 43 | - ->addColumn('created_at', function ($model) { |
|
| 43 | + ->addColumn('created_at', function($model) { |
|
| 44 | 44 | return $model->created_at; |
| 45 | 45 | }) |
| 46 | 46 | |
| 47 | - ->addColumn('content', function ($model) { |
|
| 47 | + ->addColumn('content', function($model) { |
|
| 48 | 48 | return str_limit($model->content, 10, '...'); |
| 49 | 49 | }) |
| 50 | - ->addColumn('action', function ($model) { |
|
| 50 | + ->addColumn('action', function($model) { |
|
| 51 | 51 | return '<a href='.url('pages/'.$model->id.'/edit') |
| 52 | 52 | ." class='btn btn-sm btn-primary'>Edit</a>"; |
| 53 | 53 | }) |
| 54 | 54 | |
| 55 | - ->rawColumns(['checkbox', 'name', 'url', 'created_at', 'content', 'action']) |
|
| 55 | + ->rawColumns(['checkbox', 'name', 'url', 'created_at', 'content', 'action']) |
|
| 56 | 56 | ->make(true); |
| 57 | 57 | // ->searchColumns('name', 'content') |
| 58 | 58 | // ->orderColumns('name') |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | ." class='btn btn-sm btn-primary'>Edit</a>"; |
| 53 | 53 | }) |
| 54 | 54 | |
| 55 | - ->rawColumns(['checkbox', 'name', 'url', 'created_at', 'content', 'action']) |
|
| 55 | + ->rawColumns(['checkbox', 'name', 'url', 'created_at', 'content', 'action']) |
|
| 56 | 56 | ->make(true); |
| 57 | 57 | // ->searchColumns('name', 'content') |
| 58 | 58 | // ->orderColumns('name') |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | $template = $this->getHelpdeskTemplate($helpdesk_products, $data, $trasform); |
| 303 | 303 | |
| 304 | 304 | $helpdesk_vps_product = $product->where('id', '!=', 1)->where('category', '=', 'helpdeskvps') |
| 305 | - ->get() |
|
| 305 | + ->get() |
|
| 306 | 306 | ->toArray(); |
| 307 | 307 | $trasform3 = []; |
| 308 | 308 | $helpdesk_vps_template = $this->getHelpdeskVpsTemplate($helpdesk_vps_product, $data, $trasform3); |
| 309 | 309 | |
| 310 | 310 | $servicedesk_vps_product = $product->where('id', '!=', 1)->where('category', '=', 'servicedesk vps') |
| 311 | - ->get() |
|
| 311 | + ->get() |
|
| 312 | 312 | ->toArray(); |
| 313 | 313 | $trasform4 = []; |
| 314 | 314 | $servicedesk_vps_template = $this->getServicedeskVpsTemplate($servicedesk_vps_product, $data, $trasform4); |
@@ -122,18 +122,18 @@ discard block |
||
| 122 | 122 | public function getTemplates() |
| 123 | 123 | { |
| 124 | 124 | return \DataTables::of($this->template->select('id', 'name', 'type')->get()) |
| 125 | - ->addColumn('checkbox', function ($model) { |
|
| 125 | + ->addColumn('checkbox', function($model) { |
|
| 126 | 126 | return "<input type='checkbox' class='template_checkbox' |
| 127 | 127 | value=".$model->id.' name=select[] id=check>'; |
| 128 | 128 | }) |
| 129 | 129 | |
| 130 | - ->addColumn('name', function ($model) { |
|
| 130 | + ->addColumn('name', function($model) { |
|
| 131 | 131 | return $model->name; |
| 132 | 132 | }) |
| 133 | - ->addColumn('type', function ($model) { |
|
| 133 | + ->addColumn('type', function($model) { |
|
| 134 | 134 | return $this->type->where('id', $model->type)->first()->name; |
| 135 | 135 | }) |
| 136 | - ->addColumn('action', function ($model) { |
|
| 136 | + ->addColumn('action', function($model) { |
|
| 137 | 137 | return '<a href='.url('templates/'.$model->id.'/edit'). |
| 138 | 138 | " class='btn btn-sm btn-primary'>Edit</a>"; |
| 139 | 139 | }) |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $data = $page_controller->transform($type, $data, $transform); |
| 282 | 282 | $settings = \App\Model\Common\Setting::find(1); |
| 283 | 283 | $fromname = $settings->company; |
| 284 | - \Mail::send('emails.mail', ['data' => $data], function ($m) use ($from, $to, $subject, $fromname, $toname, $cc, $attach) { |
|
| 284 | + \Mail::send('emails.mail', ['data' => $data], function($m) use ($from, $to, $subject, $fromname, $toname, $cc, $attach) { |
|
| 285 | 285 | $m->from($from, $fromname); |
| 286 | 286 | |
| 287 | 287 | $m->to($to, $toname)->subject($subject); |
@@ -18,28 +18,28 @@ |
||
| 18 | 18 | ->get(); |
| 19 | 19 | |
| 20 | 20 | return \DataTables::of($new_upload) |
| 21 | - ->addColumn('checkbox', function ($model) { |
|
| 21 | + ->addColumn('checkbox', function($model) { |
|
| 22 | 22 | return "<input type='checkbox' class='upload_checkbox' value=".$model->id.' name=select[] id=checks>'; |
| 23 | 23 | }) |
| 24 | 24 | |
| 25 | - ->addColumn('product_id', function ($model) { |
|
| 25 | + ->addColumn('product_id', function($model) { |
|
| 26 | 26 | return ucfirst($this->product->where('id', $model->product_id)->first()->name); |
| 27 | 27 | }) |
| 28 | 28 | |
| 29 | - ->addColumn('title', function ($model) { |
|
| 29 | + ->addColumn('title', function($model) { |
|
| 30 | 30 | return ucfirst($model->title); |
| 31 | 31 | }) |
| 32 | - ->addColumn('description', function ($model) { |
|
| 32 | + ->addColumn('description', function($model) { |
|
| 33 | 33 | return ucfirst($model->description); |
| 34 | 34 | }) |
| 35 | - ->addColumn('version', function ($model) { |
|
| 35 | + ->addColumn('version', function($model) { |
|
| 36 | 36 | return $model->version; |
| 37 | 37 | }) |
| 38 | 38 | |
| 39 | - ->addColumn('file', function ($model) { |
|
| 39 | + ->addColumn('file', function($model) { |
|
| 40 | 40 | return $model->file; |
| 41 | 41 | }) |
| 42 | - ->addColumn('action', function ($model) { |
|
| 42 | + ->addColumn('action', function($model) { |
|
| 43 | 43 | return '<a href='.('#edit-upload-option/'.$model->id).' |
| 44 | 44 | class=" btn btn-sm btn-primary " data-title="'.$model->title.'" |
| 45 | 45 | data-description="'.$model->description.'" data-version="' |