Completed
Push — development ( db1ef3...185f70 )
by Bhanu
122:08 queued 64:23
created
app/Http/Controllers/Front/CartController.php 2 patches
Braces   +32 added lines, -16 removed lines patch added patch discarded remove patch
@@ -64,9 +64,11 @@  discard block
 block discarded – undo
64 64
     public function productList(Request $request)
65 65
     {
66 66
         try {
67
-            if (!empty($_SERVER['HTTP_CLIENT_IP'])) {   //check ip from share internet
67
+            if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
68
+//check ip from share internet
68 69
                 $ip = $_SERVER['HTTP_CLIENT_IP'];
69
-            } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {   //to check ip is pass from proxy
70
+            } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
71
+//to check ip is pass from proxy
70 72
                 $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
71 73
             } else {
72 74
                 $ip = $_SERVER['REMOTE_ADDR'];
@@ -204,9 +206,11 @@  discard block
 block discarded – undo
204 206
 
205 207
             // $product = $this->product->findOrFail($productid);
206 208
             // dd($product);
207
-            if (!empty($_SERVER['HTTP_CLIENT_IP'])) {   //check ip from share internet
209
+            if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
210
+//check ip from share internet
208 211
                 $ip = $_SERVER['HTTP_CLIENT_IP'];
209
-            } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {   //to check ip is pass from proxy
212
+            } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
213
+//to check ip is pass from proxy
210 214
                 $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
211 215
             } else {
212 216
                 $ip = $_SERVER['REMOTE_ADDR'];
@@ -252,8 +256,10 @@  discard block
 block discarded – undo
252 256
                 $origin_state = $this->setting->first()->state; //Get the State of origin
253 257
                 $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray();
254 258
 
255
-                if ($tax_class_id) {//If the product is allowed for tax (Check in tax_product relation table)
256
-                   if ($tax_enable == 1) {//If GST is Enabled
259
+                if ($tax_class_id) {
260
+//If the product is allowed for tax (Check in tax_product relation table)
261
+                   if ($tax_enable == 1) {
262
+//If GST is Enabled
257 263
 
258 264
                              $state_code = '';
259 265
                        $c_gst = '';
@@ -264,14 +270,16 @@  discard block
 block discarded – undo
264 270
                        $rate = '';
265 271
                        $status = 1;
266 272
 
267
-                       if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user
273
+                       if ($user_state != '') {
274
+//Get the CGST,SGST,IGST,STATE_CODE of the user
268 275
 
269 276
                            $c_gst = $user_state->c_gst;
270 277
                            $s_gst = $user_state->s_gst;
271 278
                            $i_gst = $user_state->i_gst;
272 279
                            $ut_gst = $user_state->ut_gst;
273 280
                            $state_code = $user_state->state_code;
274
-                           if ($state_code == $origin_state) {//If user and origin state are same
281
+                           if ($state_code == $origin_state) {
282
+//If user and origin state are same
275 283
 
276 284
                                $taxClassId = TaxClass::where('name', 'Intra State GST')->pluck('id')->toArray(); //Get the class Id  of state
277 285
                                if ($taxClassId) {
@@ -284,7 +292,8 @@  discard block
 block discarded – undo
284 292
                                } else {
285 293
                                    $taxes = [0];
286 294
                                }
287
-                           } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state
295
+                           } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {
296
+//If user is from other state
288 297
 
289 298
                                $taxClassId = TaxClass::where('name', 'Inter State GST')->pluck('id')->toArray(); //Get the class Id  of state
290 299
                                if ($taxClassId) {
@@ -296,7 +305,8 @@  discard block
 block discarded – undo
296 305
                                } else {
297 306
                                    $taxes = [0];
298 307
                                }
299
-                           } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory
308
+                           } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {
309
+//if user from Union Territory
300 310
                         $taxClassId = TaxClass::where('name', 'Union Territory GST')->pluck('id')->toArray(); //Get the class Id  of state
301 311
                         if ($taxClassId) {
302 312
                             $taxes = $this->getTaxByPriority($taxClassId);
@@ -308,11 +318,13 @@  discard block
 block discarded – undo
308 318
                             $taxes = [0];
309 319
                         }
310 320
                            }
311
-                       } else {//If user from other Country
321
+                       } else {
322
+//If user from other Country
312 323
 
313 324
                            $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first();
314 325
 
315
-                           if ($taxClassId) { //if state equals the user State or country equals user country
326
+                           if ($taxClassId) {
327
+//if state equals the user State or country equals user country
316 328
 
317 329
                                $taxes = $this->getTaxByPriority($taxClassId);
318 330
                                $value = $this->getValueForOthers($productid, $taxClassId, $taxes);
@@ -320,7 +332,8 @@  discard block
 block discarded – undo
320 332
                                    $status = 0;
321 333
                                }
322 334
                                $rate = $value;
323
-                           } else {//if Tax is selected for Any Country Any State
335
+                           } else {
336
+//if Tax is selected for Any Country Any State
324 337
                                $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first();
325 338
                                if ($taxClassId) {
326 339
                                    $taxes = $this->getTaxByPriority($taxClassId);
@@ -357,7 +370,8 @@  discard block
 block discarded – undo
357 370
                                          ]);
358 371
                            }
359 372
                        }
360
-                   } elseif ($tax_enable == 0) {//If Tax enable is 0
373
+                   } elseif ($tax_enable == 0) {
374
+//If Tax enable is 0
361 375
                        $status = 1;
362 376
                        if ($this->tax_option->findOrFail(1)->tax_enable == 0) {
363 377
                            $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); //In case of India when other tax is available and tax is not enabled
@@ -378,9 +392,11 @@  discard block
 block discarded – undo
378 392
                                             'value'  => $value,
379 393
                                         ]);
380 394
                                }
381
-                           } else {//In case of other country when tax is available and tax is not enabled(Applicable when Global Tax class for any country and state is not there)
395
+                           } else {
396
+//In case of other country when tax is available and tax is not enabled(Applicable when Global Tax class for any country and state is not there)
382 397
                                $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first();
383
-                               if ($taxClassId) { //if state equals the user State
398
+                               if ($taxClassId) {
399
+//if state equals the user State
384 400
                                    $taxes = $this->getTaxByPriority($taxClassId);
385 401
                                    $value = $this->getValueForOthers($productid, $taxClassId, $taxes);
386 402
                                    if ($value == '') {
Please login to merge, or discard this patch.
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -246,50 +246,50 @@  discard block
 block discarded – undo
246 246
                 $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray();
247 247
 
248 248
                 if ($tax_class_id) {//If the product is allowed for tax (Check in tax_product relation table)
249
-                   if ($tax_enable == 1) {//If GST is Enabled
250
-
251
-                             $state_code = '';
252
-                       $c_gst = '';
253
-                       $s_gst = '';
254
-                       $i_gst = '';
255
-                       $ut_gst = '';
256
-                       $value = '';
257
-                       $rate = '';
258
-                       $status = 1;
259
-
260
-                       if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user
261
-
262
-                           $c_gst = $user_state->c_gst;
263
-                           $s_gst = $user_state->s_gst;
264
-                           $i_gst = $user_state->i_gst;
265
-                           $ut_gst = $user_state->ut_gst;
266
-                           $state_code = $user_state->state_code;
267
-                           if ($state_code == $origin_state) {//If user and origin state are same
268
-
269
-                               $taxClassId = TaxClass::where('name', 'Intra State GST')->pluck('id')->toArray(); //Get the class Id  of state
270
-                               if ($taxClassId) {
271
-                                   $taxes = $this->getTaxByPriority($taxClassId);
272
-                                   $value = $this->getValueForSameState($productid, $c_gst, $s_gst, $taxClassId, $taxes);
273
-
274
-                                   if ($value == '') {
275
-                                       $status = 0;
276
-                                   }
277
-                               } else {
278
-                                   $taxes = [0];
279
-                               }
280
-                           } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state
281
-
282
-                               $taxClassId = TaxClass::where('name', 'Inter State GST')->pluck('id')->toArray(); //Get the class Id  of state
283
-                               if ($taxClassId) {
284
-                                   $taxes = $this->getTaxByPriority($taxClassId);
285
-                                   $value = $this->getValueForOtherState($productid, $i_gst, $taxClassId, $taxes);
286
-                                   if ($value == '') {
287
-                                       $status = 0;
288
-                                   }
289
-                               } else {
290
-                                   $taxes = [0];
291
-                               }
292
-                           } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory
249
+                    if ($tax_enable == 1) {//If GST is Enabled
250
+
251
+                                $state_code = '';
252
+                        $c_gst = '';
253
+                        $s_gst = '';
254
+                        $i_gst = '';
255
+                        $ut_gst = '';
256
+                        $value = '';
257
+                        $rate = '';
258
+                        $status = 1;
259
+
260
+                        if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user
261
+
262
+                            $c_gst = $user_state->c_gst;
263
+                            $s_gst = $user_state->s_gst;
264
+                            $i_gst = $user_state->i_gst;
265
+                            $ut_gst = $user_state->ut_gst;
266
+                            $state_code = $user_state->state_code;
267
+                            if ($state_code == $origin_state) {//If user and origin state are same
268
+
269
+                                $taxClassId = TaxClass::where('name', 'Intra State GST')->pluck('id')->toArray(); //Get the class Id  of state
270
+                                if ($taxClassId) {
271
+                                    $taxes = $this->getTaxByPriority($taxClassId);
272
+                                    $value = $this->getValueForSameState($productid, $c_gst, $s_gst, $taxClassId, $taxes);
273
+
274
+                                    if ($value == '') {
275
+                                        $status = 0;
276
+                                    }
277
+                                } else {
278
+                                    $taxes = [0];
279
+                                }
280
+                            } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state
281
+
282
+                                $taxClassId = TaxClass::where('name', 'Inter State GST')->pluck('id')->toArray(); //Get the class Id  of state
283
+                                if ($taxClassId) {
284
+                                    $taxes = $this->getTaxByPriority($taxClassId);
285
+                                    $value = $this->getValueForOtherState($productid, $i_gst, $taxClassId, $taxes);
286
+                                    if ($value == '') {
287
+                                        $status = 0;
288
+                                    }
289
+                                } else {
290
+                                    $taxes = [0];
291
+                                }
292
+                            } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory
293 293
                         $taxClassId = TaxClass::where('name', 'Union Territory GST')->pluck('id')->toArray(); //Get the class Id  of state
294 294
                         if ($taxClassId) {
295 295
                             $taxes = $this->getTaxByPriority($taxClassId);
@@ -300,101 +300,101 @@  discard block
 block discarded – undo
300 300
                         } else {
301 301
                             $taxes = [0];
302 302
                         }
303
-                           }
304
-                       } else {//If user from other Country
305
-
306
-                           $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first();
307
-
308
-                           if ($taxClassId) { //if state equals the user State or country equals user country
309
-
310
-                               $taxes = $this->getTaxByPriority($taxClassId);
311
-                               $value = $this->getValueForOthers($productid, $taxClassId, $taxes);
312
-                               if ($value == '') {
313
-                                   $status = 0;
314
-                               }
315
-                               $rate = $value;
316
-                           } else {//if Tax is selected for Any Country Any State
317
-                               $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first();
318
-                               if ($taxClassId) {
319
-                                   $taxes = $this->getTaxByPriority($taxClassId);
320
-                                   $value = $this->getValueForOthers($productid, $taxClassId, $taxes);
321
-                                   if ($value == '') {
322
-                                       $status = 0;
323
-                                   }
324
-                                   $rate = $value;
325
-                               } else {
326
-                                   $taxes = [0];
327
-                               }
328
-                           }
329
-                       }
330
-                       foreach ($taxes as $key => $tax) {
303
+                            }
304
+                        } else {//If user from other Country
305
+
306
+                            $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first();
307
+
308
+                            if ($taxClassId) { //if state equals the user State or country equals user country
309
+
310
+                                $taxes = $this->getTaxByPriority($taxClassId);
311
+                                $value = $this->getValueForOthers($productid, $taxClassId, $taxes);
312
+                                if ($value == '') {
313
+                                    $status = 0;
314
+                                }
315
+                                $rate = $value;
316
+                            } else {//if Tax is selected for Any Country Any State
317
+                                $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first();
318
+                                if ($taxClassId) {
319
+                                    $taxes = $this->getTaxByPriority($taxClassId);
320
+                                    $value = $this->getValueForOthers($productid, $taxClassId, $taxes);
321
+                                    if ($value == '') {
322
+                                        $status = 0;
323
+                                    }
324
+                                    $rate = $value;
325
+                                } else {
326
+                                    $taxes = [0];
327
+                                }
328
+                            }
329
+                        }
330
+                        foreach ($taxes as $key => $tax) {
331 331
 
332 332
                                     //All the da a attribute that is sent to the checkout Page if tax_compound=0
333
-                           if ($taxes[0]) {
334
-                               $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, 's_gst'=>$s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, 'state'=>$state_code, 'origin_state'=>$origin_state, 'tax_enable'=>$tax_enable, 'rate'=>$value, 'status'=>$status];
333
+                            if ($taxes[0]) {
334
+                                $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, 's_gst'=>$s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, 'state'=>$state_code, 'origin_state'=>$origin_state, 'tax_enable'=>$tax_enable, 'rate'=>$value, 'status'=>$status];
335 335
 
336
-                               $taxCondition[0] = new \Darryldecode\Cart\CartCondition([
336
+                                $taxCondition[0] = new \Darryldecode\Cart\CartCondition([
337 337
 
338 338
                                             'name'   => 'no compound',
339 339
                                             'type'   => 'tax',
340 340
                                             'target' => 'item',
341 341
                                             'value'  => $value,
342
-                                          ]);
343
-                           } else {
344
-                               $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0];
345
-                               $taxCondition[0] = new \Darryldecode\Cart\CartCondition([
346
-                                           'name'   => 'null',
347
-                                           'type'   => 'tax',
348
-                                           'target' => 'item',
349
-                                           'value'  => '0%',
350
-                                         ]);
351
-                           }
352
-                       }
353
-                   } elseif ($tax_enable == 0) {//If Tax enable is 0
354
-                       $status = 1;
355
-                       if ($this->tax_option->findOrFail(1)->tax_enable == 0) {
356
-                           $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); //In case of India when other tax is available and tax is not enabled
357
-
358
-                           if ($taxClassId) {
359
-                               $taxes = $this->getTaxByPriority($taxClassId);
360
-                               $value = $this->getValueForOthers($productid, $taxClassId, $taxes);
361
-                               if ($value == 0) {
362
-                                   $status = 0;
363
-                               }
364
-                               $rate = $value;
365
-                               foreach ($taxes as $key => $tax) {
366
-                                   $tax_attribute[$key] = ['name' => $tax->name, 'rate' => $value, 'tax_enable'=>0, 'status' => $status];
367
-                                   $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([
342
+                                            ]);
343
+                            } else {
344
+                                $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0];
345
+                                $taxCondition[0] = new \Darryldecode\Cart\CartCondition([
346
+                                            'name'   => 'null',
347
+                                            'type'   => 'tax',
348
+                                            'target' => 'item',
349
+                                            'value'  => '0%',
350
+                                            ]);
351
+                            }
352
+                        }
353
+                    } elseif ($tax_enable == 0) {//If Tax enable is 0
354
+                        $status = 1;
355
+                        if ($this->tax_option->findOrFail(1)->tax_enable == 0) {
356
+                            $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); //In case of India when other tax is available and tax is not enabled
357
+
358
+                            if ($taxClassId) {
359
+                                $taxes = $this->getTaxByPriority($taxClassId);
360
+                                $value = $this->getValueForOthers($productid, $taxClassId, $taxes);
361
+                                if ($value == 0) {
362
+                                    $status = 0;
363
+                                }
364
+                                $rate = $value;
365
+                                foreach ($taxes as $key => $tax) {
366
+                                    $tax_attribute[$key] = ['name' => $tax->name, 'rate' => $value, 'tax_enable'=>0, 'status' => $status];
367
+                                    $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([
368 368
 
369 369
                                             'name'   => $tax->name,
370 370
                                             'type'   => 'tax',
371 371
                                             'target' => 'item',
372 372
                                             'value'  => $value,
373 373
                                         ]);
374
-                               }
375
-                           } else {//In case of other country when tax is available and tax is not enabled(Applicable when Global Tax class for any country and state is not there)
376
-                               $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first();
377
-                               if ($taxClassId) { //if state equals the user State
378
-                                   $taxes = $this->getTaxByPriority($taxClassId);
379
-                                   $value = $this->getValueForOthers($productid, $taxClassId, $taxes);
380
-                                   if ($value == '') {
381
-                                       $status = 0;
382
-                                   }
383
-                                   $rate = $value;
384
-                               }
385
-                               foreach ($taxes as $key => $tax) {
386
-                                   $tax_attribute[$key] = ['name' => $tax->name, 'rate' => $value, 'tax_enable'=>0, 'status' => $status];
387
-                                   $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([
374
+                                }
375
+                            } else {//In case of other country when tax is available and tax is not enabled(Applicable when Global Tax class for any country and state is not there)
376
+                                $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first();
377
+                                if ($taxClassId) { //if state equals the user State
378
+                                    $taxes = $this->getTaxByPriority($taxClassId);
379
+                                    $value = $this->getValueForOthers($productid, $taxClassId, $taxes);
380
+                                    if ($value == '') {
381
+                                        $status = 0;
382
+                                    }
383
+                                    $rate = $value;
384
+                                }
385
+                                foreach ($taxes as $key => $tax) {
386
+                                    $tax_attribute[$key] = ['name' => $tax->name, 'rate' => $value, 'tax_enable'=>0, 'status' => $status];
387
+                                    $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([
388 388
 
389 389
                                             'name'   => $tax->name,
390 390
                                             'type'   => 'tax',
391 391
                                             'target' => 'item',
392 392
                                             'value'  => $value,
393 393
                                         ]);
394
-                               }
395
-                           }
396
-                       }
397
-                   }
394
+                                }
395
+                            }
396
+                        }
397
+                    }
398 398
                 } else {
399 399
                     $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0];
400 400
                     $taxCondition[0] = new \Darryldecode\Cart\CartCondition([
Please login to merge, or discard this patch.
app/Http/Controllers/Common/SettingsController.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
                         ->addColumn('version', function ($model) {
88 88
                             return $model['version'];
89 89
                         })
90
-                      ->rawColumns(['name', 'description', 'author', 'website', 'version'])
90
+                        ->rawColumns(['name', 'description', 'author', 'website', 'version'])
91 91
                             ->make(true);
92 92
     }
93 93
 
Please login to merge, or discard this patch.