Completed
Push — development ( 0b761c...c78083 )
by Bhanu
31:07 queued 20:56
created
app/Http/Controllers/Order/BaseOrderController.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@
 block discarded – undo
151 151
                 $user_id = $this->order->find($orderid)->client;
152 152
                 $this->subscription->create(['user_id' => $user_id,
153 153
                     'plan_id'                          => $planid, 'order_id' => $orderid, 'ends_at' => $ends_at,
154
-                     'version'                         => $version, 'product_id' =>$product, ]);
154
+                        'version'                         => $version, 'product_id' =>$product, ]);
155 155
             }
156 156
         } catch (\Exception $ex) {
157 157
             Bugsnag::notifyException($ex);
Please login to merge, or discard this patch.
app/Http/Controllers/Front/ClientController.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         try {
130 130
             $versions = ProductUpload::where('product_id', $productid)
131 131
             ->select('id', 'product_id', 'version',
132
-             'title', 'description', 'file', 'created_at')->get();
132
+                'title', 'description', 'file', 'created_at')->get();
133 133
 
134 134
             return \DataTables::of($versions)
135 135
                             ->addColumn('id', function ($versions) {
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
             $bussinesses = \App\Model\Common\Bussiness::pluck('name', 'short')->toArray();
319 319
 
320 320
             return view('themes.default1.front.clients.profile',
321
-             compact('user', 'timezones', 'state', 'states', 'bussinesses'));
321
+                compact('user', 'timezones', 'state', 'states', 'bussinesses'));
322 322
         } catch (Exception $ex) {
323 323
             Bugsnag::notifyException($ex);
324 324
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
                                 return $model->grand_total;
398 398
                             })
399 399
                             ->rawColumns(['checkbox', 'number', 'total',
400
-                             'payment_method', 'payment_status', 'created_at', ])
400
+                                'payment_method', 'payment_status', 'created_at', ])
401 401
                             ->make(true);
402 402
         } catch (Exception $ex) {
403 403
             Bugsnag::notifyException($ex);
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
                             ->addColumn('number', function ($model) {
424 424
                                 return $model->invoice()->first()->number;
425 425
                             })
426
-                              ->addColumn('total', function ($model) {
427
-                                  return $model->amount;
428
-                              })
429
-                               ->addColumn('created_at', function ($model) {
430
-                                   $date1 = new DateTime($model->created_at);
431
-                                   $tz = \Auth::user()->timezone()->first()->name;
432
-                                   $date1->setTimezone(new DateTimeZone($tz));
433
-                                   $date = $date1->format('M j, Y, g:i a');
434
-
435
-                                   return $date;
436
-                               })
426
+                                ->addColumn('total', function ($model) {
427
+                                    return $model->amount;
428
+                                })
429
+                                ->addColumn('created_at', function ($model) {
430
+                                    $date1 = new DateTime($model->created_at);
431
+                                    $tz = \Auth::user()->timezone()->first()->name;
432
+                                    $date1->setTimezone(new DateTimeZone($tz));
433
+                                    $date = $date1->format('M j, Y, g:i a');
434
+
435
+                                    return $date;
436
+                                })
437 437
 
438 438
                             ->addColumn('payment_method', 'payment_status', 'created_at')
439 439
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -77,20 +77,20 @@  discard block
 block discarded – undo
77 77
                     ->select('number', 'created_at', 'grand_total', 'id', 'status');
78 78
 
79 79
             return \DataTables::of($invoices->get())
80
-                            ->addColumn('number', function ($model) {
80
+                            ->addColumn('number', function($model) {
81 81
                                 return $model->number;
82 82
                             })
83
-                            ->addColumn('date', function ($model) {
83
+                            ->addColumn('date', function($model) {
84 84
                                 $date = $model->created_at;
85 85
 
86 86
                                 return $date;
87 87
                                 // $myobject->created_at->timezone($this->auth->user()->timezone);
88 88
                             })
89 89
                             // ->showColumns('created_at')
90
-                            ->addColumn('total', function ($model) {
90
+                            ->addColumn('total', function($model) {
91 91
                                 return $model->grand_total;
92 92
                             })
93
-                            ->addColumn('Action', function ($model) {
93
+                            ->addColumn('Action', function($model) {
94 94
                                 $status = $model->status;
95 95
                                 $payment = '';
96 96
                                 if ($status == 'Pending' && $model->grand_total > 0) {
@@ -132,19 +132,19 @@  discard block
 block discarded – undo
132 132
              'title', 'description', 'file', 'created_at')->get();
133 133
 
134 134
             return \DataTables::of($versions)
135
-                            ->addColumn('id', function ($versions) {
135
+                            ->addColumn('id', function($versions) {
136 136
                                 return ucfirst($versions->id);
137 137
                             })
138
-                            ->addColumn('version', function ($versions) {
138
+                            ->addColumn('version', function($versions) {
139 139
                                 return ucfirst($versions->version);
140 140
                             })
141
-                            ->addColumn('title', function ($versions) {
141
+                            ->addColumn('title', function($versions) {
142 142
                                 return ucfirst($versions->title);
143 143
                             })
144
-                            ->addColumn('description', function ($versions) {
144
+                            ->addColumn('description', function($versions) {
145 145
                                 return ucfirst($versions->description);
146 146
                             })
147
-                            ->addColumn('file', function ($versions) use ($clientid, $invoiceid, $productid) {
147
+                            ->addColumn('file', function($versions) use ($clientid, $invoiceid, $productid) {
148 148
                                 $invoice_id = Invoice::where('number', $invoiceid)->pluck('id')->first();
149 149
                                 $order = Order::where('invoice_id', '=', $invoice_id)->first();
150 150
                                 $order_id = $order->id;
@@ -196,18 +196,18 @@  discard block
 block discarded – undo
196 196
             $link = (array_slice($link, 0, 10, true));
197 197
 
198 198
             return \DataTables::of($link)
199
-                            ->addColumn('version', function ($link) {
199
+                            ->addColumn('version', function($link) {
200 200
                                 return ucfirst($link['tag_name']);
201 201
                             })
202
-                            ->addColumn('name', function ($link) {
202
+                            ->addColumn('name', function($link) {
203 203
                                 return ucfirst($link['name']);
204 204
                             })
205
-                            ->addColumn('description', function ($link) {
205
+                            ->addColumn('description', function($link) {
206 206
                                 $markdown = Markdown::convertToHtml(ucfirst($link['body']));
207 207
 
208 208
                                 return $markdown;
209 209
                             })
210
-                            ->addColumn('file', function ($link) use ($invoiceid, $productid) {
210
+                            ->addColumn('file', function($link) use ($invoiceid, $productid) {
211 211
                                 $order = Order::where('invoice_id', '=', $invoiceid)->first();
212 212
                                 $order_id = $order->id;
213 213
                                 $orderEndDate = Subscription::select('ends_at')
@@ -255,20 +255,20 @@  discard block
 block discarded – undo
255 255
             $orders = Order::where('client', \Auth::user()->id);
256 256
 
257 257
             return \DataTables::of($orders->get())
258
-                            ->addColumn('id', function ($model) {
258
+                            ->addColumn('id', function($model) {
259 259
                                 return $model->id;
260 260
                             })
261
-                            ->addColumn('product_name', function ($model) {
261
+                            ->addColumn('product_name', function($model) {
262 262
                                 return $model->product()->first()->name;
263 263
                             })
264
-                            ->addColumn('expiry', function ($model) {
264
+                            ->addColumn('expiry', function($model) {
265 265
                                 $tz = \Auth::user()->timezone()->first()->name;
266 266
                                 $end = $this->getExpiryDate($model);
267 267
 
268 268
                                 return $end;
269 269
                             })
270 270
 
271
-                            ->addColumn('Action', function ($model) {
271
+                            ->addColumn('Action', function($model) {
272 272
                                 $sub = $model->subscription()->first();
273 273
                                 $order = Order::where('id', $model->id)->select('product')->first();
274 274
                                 $productid = $order->product;
@@ -383,17 +383,17 @@  discard block
 block discarded – undo
383 383
                     ->select('id', 'invoice_id', 'user_id', 'amount', 'payment_method', 'payment_status', 'created_at');
384 384
 
385 385
             return \DataTables::of($payments->get())
386
-                            ->addColumn('checkbox', function ($model) {
386
+                            ->addColumn('checkbox', function($model) {
387 387
                                 if (\Input::get('client') != 'true') {
388 388
                                     return "<input type='checkbox' class='payment_checkbox' 
389 389
                                     value=".$model->id.' name=select[] id=check>';
390 390
                                 }
391 391
                             })
392
-                            ->addColumn('number', function ($model) {
392
+                            ->addColumn('number', function($model) {
393 393
                                 return $model->invoice()->first()->number;
394 394
                             })
395 395
                             ->addColumn('amount', 'payment_method', 'payment_status', 'created_at')
396
-                            ->addColumn('total', function ($model) {
396
+                            ->addColumn('total', function($model) {
397 397
                                 return $model->grand_total;
398 398
                             })
399 399
                             ->rawColumns(['checkbox', 'number', 'total',
@@ -420,13 +420,13 @@  discard block
 block discarded – undo
420 420
                     ->select('id', 'invoice_id', 'user_id', 'payment_method', 'payment_status', 'created_at', 'amount');
421 421
             //dd(\Input::all());
422 422
             return \DataTables::of($payments->get())
423
-                            ->addColumn('number', function ($model) {
423
+                            ->addColumn('number', function($model) {
424 424
                                 return $model->invoice()->first()->number;
425 425
                             })
426
-                              ->addColumn('total', function ($model) {
426
+                              ->addColumn('total', function($model) {
427 427
                                   return $model->amount;
428 428
                               })
429
-                               ->addColumn('created_at', function ($model) {
429
+                               ->addColumn('created_at', function($model) {
430 430
                                    $date1 = new DateTime($model->created_at);
431 431
                                    $tz = \Auth::user()->timezone()->first()->name;
432 432
                                    $date1->setTimezone(new DateTimeZone($tz));
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -154,11 +154,13 @@
 block discarded – undo
154 154
 
155 155
                                 //if product has expiry date ie sunscriptioon is generated
156 156
                                 if ($endDate) {
157
-                                    if ($getDownloadCondition == 1) {//Perpetual download till expiry selected
157
+                                    if ($getDownloadCondition == 1) {
158
+//Perpetual download till expiry selected
158 159
                                         $getDownload = $this->whenDownloadTillExpiry($endDate, $productid, $versions, $clientid, $invoiceid);
159 160
 
160 161
                                         return $getDownload;
161
-                                    } elseif ($getDownloadCondition == 0) {//When download retires after subscription
162
+                                    } elseif ($getDownloadCondition == 0) {
163
+//When download retires after subscription
162 164
 
163 165
                                         $getDownload = $this->whenDownloadExpiresAfterExpiry($endDate, $productid, $versions, $clientid, $invoiceid);
164 166
 
Please login to merge, or discard this patch.
app/Http/Controllers/Product/PlanController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,19 +58,19 @@  discard block
 block discarded – undo
58 58
         $new_plan = Plan::select('id', 'name', 'days', 'product')->get();
59 59
 
60 60
         return\ DataTables::of($new_plan)
61
-                        ->addColumn('checkbox', function ($model) {
61
+                        ->addColumn('checkbox', function($model) {
62 62
                             return "<input type='checkbox' class='plan_checkbox' 
63 63
                             value=".$model->id.' name=select[] id=check>';
64 64
                         })
65
-                        ->addColumn('name', function ($model) {
65
+                        ->addColumn('name', function($model) {
66 66
                             return ucfirst($model->name);
67 67
                         })
68
-                        ->addColumn('days', function ($model) {
68
+                        ->addColumn('days', function($model) {
69 69
                             $months = $model->days / 30;
70 70
 
71 71
                             return round($months);
72 72
                         })
73
-                        ->addColumn('product', function ($model) {
73
+                        ->addColumn('product', function($model) {
74 74
                             $productid = $model->product;
75 75
                             $product = $this->product->where('id', $productid)->first();
76 76
                             $response = '';
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
                             return ucfirst($response);
82 82
                         })
83
-                        ->addColumn('action', function ($model) {
83
+                        ->addColumn('action', function($model) {
84 84
                             return '<a href='.url('plans/'.$model->id.'/edit')." 
85 85
                             class='btn btn-sm btn-primary btn-xs'><i class='fa fa-edit' 
86 86
                             style='color:white;'> </i>&nbsp;&nbsp;Edit</a>";
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
         $products = $this->product->pluck('name', 'id')->toArray();
172 172
         foreach ($products as $key => $product) {
173 173
             $selectedProduct = $this->product->where('id', $plan->product)
174
-          ->pluck('name', 'id', 'subscription')->toArray();
174
+            ->pluck('name', 'id', 'subscription')->toArray();
175 175
         }
176 176
         $selectedPeriods = $this->period->where('days', $plan->days)
177
-       ->pluck('name', 'days')->toArray();
177
+        ->pluck('name', 'days')->toArray();
178 178
 
179 179
         return view('themes.default1.product.plan.edit',
180 180
             compact('plan', 'currency', 'add_price', 'renew_price', 'periods', 'products',
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             'name'          => 'required',
198 198
             'add_price.*'   => 'required',
199 199
             'product'       => 'required',
200
-              'days'        => $days_rule.'numeric',
200
+                'days'        => $days_rule.'numeric',
201 201
         ]);
202 202
         $plan = $this->plan->where('id', $id)->first();
203 203
         $plan->fill($request->input())->save();
Please login to merge, or discard this patch.
app/Http/Controllers/Front/CartController.php 1 patch
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -192,149 +192,149 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.