Completed
Push — development ( a96186...0b761c )
by Ashutosh
10:54
created
app/Http/Controllers/Product/PlanController.php 3 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
         $periods = $this->period->pluck('name', 'days')->toArray();
171 171
         $products = $this->product->pluck('name', 'id')->toArray();
172 172
         foreach ($products as $key => $product) {
173
-          $selectedProduct = $this->product->where('id',$plan->product)
174
-          ->pluck('name','id','subscription')->toArray();
175
-       }
176
-      $selectedPeriods = $this->period->where('days',$plan->days)
177
-       ->pluck('name', 'days')->toArray();
173
+            $selectedProduct = $this->product->where('id',$plan->product)
174
+            ->pluck('name','id','subscription')->toArray();
175
+        }
176
+        $selectedPeriods = $this->period->where('days',$plan->days)
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',
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
      */
191 191
     public function update($id, Request $request)
192 192
     {
193
-         $subs = Product::where('id',$request->input('product'))->value('subscription');
193
+            $subs = Product::where('id',$request->input('product'))->value('subscription');
194 194
         $days_rule = $subs == 1 ? 'required|' : 'sometimes|';
195 195
 
196 196
         $this->validate($request, [
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();
@@ -279,12 +279,12 @@  discard block
 block discarded – undo
279 279
 
280 280
     public function checkSubscription(Request $request)
281 281
     {
282
-      try{
283
-      $product_id = $request->input('product_id');
284
-      $checkSubscription = Product::where('id',$product_id)->value('subscription');
285
-      $result = ['subscription'=> $checkSubscription];
286
-      return response()->json($result);
287
-      }catch (\Exception $ex) {
282
+        try{
283
+        $product_id = $request->input('product_id');
284
+        $checkSubscription = Product::where('id',$product_id)->value('subscription');
285
+        $result = ['subscription'=> $checkSubscription];
286
+        return response()->json($result);
287
+        }catch (\Exception $ex) {
288 288
             Bugsnag::notifyException($ex);
289 289
             $result = ['subscription' => $ex->getMessage()];
290 290
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 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>";
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function store(Request $request)
112 112
     {
113
-        $subs = Product::where('id',$request->input('product'))->value('subscription');
113
+        $subs = Product::where('id', $request->input('product'))->value('subscription');
114 114
         $days_rule = $subs == 1 ? 'required|' : 'sometimes|';
115 115
 
116 116
         $this->validate($request, [
117 117
             'name'        => 'required',
118
-            'days'        => $days_rule . 'numeric',
118
+            'days'        => $days_rule.'numeric',
119 119
             'add_price.*' => 'required',
120 120
             'product'     => 'required',
121 121
         ]);
@@ -170,15 +170,15 @@  discard block
 block discarded – undo
170 170
         $periods = $this->period->pluck('name', 'days')->toArray();
171 171
         $products = $this->product->pluck('name', 'id')->toArray();
172 172
         foreach ($products as $key => $product) {
173
-          $selectedProduct = $this->product->where('id',$plan->product)
174
-          ->pluck('name','id','subscription')->toArray();
173
+          $selectedProduct = $this->product->where('id', $plan->product)
174
+          ->pluck('name', 'id', 'subscription')->toArray();
175 175
        }
176
-      $selectedPeriods = $this->period->where('days',$plan->days)
176
+      $selectedPeriods = $this->period->where('days', $plan->days)
177 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',
181
-                'selectedPeriods','selectedProduct'));
181
+                'selectedPeriods', 'selectedProduct'));
182 182
     }
183 183
 
184 184
     /**
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
      */
191 191
     public function update($id, Request $request)
192 192
     {
193
-         $subs = Product::where('id',$request->input('product'))->value('subscription');
193
+         $subs = Product::where('id', $request->input('product'))->value('subscription');
194 194
         $days_rule = $subs == 1 ? 'required|' : 'sometimes|';
195 195
 
196 196
         $this->validate($request, [
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();
@@ -279,12 +279,12 @@  discard block
 block discarded – undo
279 279
 
280 280
     public function checkSubscription(Request $request)
281 281
     {
282
-      try{
282
+      try {
283 283
       $product_id = $request->input('product_id');
284
-      $checkSubscription = Product::where('id',$product_id)->value('subscription');
284
+      $checkSubscription = Product::where('id', $product_id)->value('subscription');
285 285
       $result = ['subscription'=> $checkSubscription];
286 286
       return response()->json($result);
287
-      }catch (\Exception $ex) {
287
+      } catch (\Exception $ex) {
288 288
             Bugsnag::notifyException($ex);
289 289
             $result = ['subscription' => $ex->getMessage()];
290 290
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -279,12 +279,12 @@
 block discarded – undo
279 279
 
280 280
     public function checkSubscription(Request $request)
281 281
     {
282
-      try{
282
+      try {
283 283
       $product_id = $request->input('product_id');
284 284
       $checkSubscription = Product::where('id',$product_id)->value('subscription');
285 285
       $result = ['subscription'=> $checkSubscription];
286 286
       return response()->json($result);
287
-      }catch (\Exception $ex) {
287
+      } catch (\Exception $ex) {
288 288
             Bugsnag::notifyException($ex);
289 289
             $result = ['subscription' => $ex->getMessage()];
290 290
 
Please login to merge, or discard this patch.
app/Http/Controllers/Front/CartController.php 1 patch
Indentation   +121 added lines, -121 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.'%';
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
      */
601 601
     public static function rounding($price)
602 602
     {
603
-      try {
603
+        try {
604 604
             $tax_rule = new \App\Model\Payment\TaxOption();
605 605
             $rule = $tax_rule->findOrFail(1);
606 606
             $rounding = $rule->rounding;
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
             if ($subregion) {
724 724
                 $result = ['id' => $subregion->state_subdivision_code,
725 725
 
726
-                     'name' => $subregion->state_subdivision_name, ];
726
+                        'name' => $subregion->state_subdivision_name, ];
727 727
             }
728 728
 
729 729
             return $result;
Please login to merge, or discard this patch.
app/Http/Controllers/Front/ClientController.php 3 patches
Indentation   +18 added lines, -18 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) {
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
                                 //if product has expiry date ie sunscriptioon is generated
156 156
                                 if ($endDate) {
157 157
                                     if ($getDownloadCondition == 1){//Perpetual download till expiry selected
158
-                                     $getDownload = $this->whenDownloadTillExpiry($endDate,$productid,$versions,$clientid,$invoiceid);
158
+                                        $getDownload = $this->whenDownloadTillExpiry($endDate,$productid,$versions,$clientid,$invoiceid);
159 159
                                         return $getDownload;
160 160
                          
161
-                                  }elseif($getDownloadCondition == 0){//When download retires after subscription
161
+                                    }elseif($getDownloadCondition == 0){//When download retires after subscription
162 162
                                           
163 163
                                         $getDownload =  $this->whenDownloadExpiresAfterExpiry($endDate,$productid,$versions,$clientid,$invoiceid);
164 164
                                         return $getDownload;
165
-                                  }
165
+                                    }
166 166
                                 }
167 167
                             })
168 168
                             ->rawColumns(['version', 'title', 'description', 'file'])
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
     public function whenDownloadTillExpiry($endDate,$productid,$versions,$clientid,$invoiceid)
178 178
     {
179
-      if ($versions->created_at->toDateTimeString()
179
+        if ($versions->created_at->toDateTimeString()
180 180
 
181 181
         < $endDate->ends_at->toDateTimeString()) {
182 182
             return '<p><a href='.url('download/'.$productid.'/'
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             $bussinesses = \App\Model\Common\Bussiness::pluck('name', 'short')->toArray();
358 358
 
359 359
             return view('themes.default1.front.clients.profile',
360
-             compact('user', 'timezones', 'state', 'states', 'bussinesses'));
360
+                compact('user', 'timezones', 'state', 'states', 'bussinesses'));
361 361
         } catch (Exception $ex) {
362 362
             Bugsnag::notifyException($ex);
363 363
 
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
                                 return $model->grand_total;
437 437
                             })
438 438
                             ->rawColumns(['checkbox', 'number', 'total',
439
-                             'payment_method', 'payment_status', 'created_at', ])
439
+                                'payment_method', 'payment_status', 'created_at', ])
440 440
                             ->make(true);
441 441
         } catch (Exception $ex) {
442 442
             Bugsnag::notifyException($ex);
@@ -462,17 +462,17 @@  discard block
 block discarded – undo
462 462
                             ->addColumn('number', function ($model) {
463 463
                                 return $model->invoice()->first()->number;
464 464
                             })
465
-                              ->addColumn('total', function ($model) {
466
-                                  return $model->amount;
467
-                              })
468
-                               ->addColumn('created_at', function ($model) {
469
-                                   $date1 = new DateTime($model->created_at);
470
-                                   $tz = \Auth::user()->timezone()->first()->name;
471
-                                   $date1->setTimezone(new DateTimeZone($tz));
472
-                                   $date = $date1->format('M j, Y, g:i a');
473
-
474
-                                   return $date;
475
-                               })
465
+                                ->addColumn('total', function ($model) {
466
+                                    return $model->amount;
467
+                                })
468
+                                ->addColumn('created_at', function ($model) {
469
+                                    $date1 = new DateTime($model->created_at);
470
+                                    $tz = \Auth::user()->timezone()->first()->name;
471
+                                    $date1->setTimezone(new DateTimeZone($tz));
472
+                                    $date = $date1->format('M j, Y, g:i a');
473
+
474
+                                    return $date;
475
+                                })
476 476
 
477 477
                             ->addColumn('payment_method', 'payment_status', 'created_at')
478 478
 
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 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;
@@ -154,13 +154,13 @@  discard block
 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
158
-                                     $getDownload = $this->whenDownloadTillExpiry($endDate,$productid,$versions,$clientid,$invoiceid);
157
+                                    if ($getDownloadCondition == 1) {//Perpetual download till expiry selected
158
+                                     $getDownload = $this->whenDownloadTillExpiry($endDate, $productid, $versions, $clientid, $invoiceid);
159 159
                                         return $getDownload;
160 160
                          
161
-                                  }elseif($getDownloadCondition == 0){//When download retires after subscription
161
+                                  }elseif ($getDownloadCondition == 0) {//When download retires after subscription
162 162
                                           
163
-                                        $getDownload =  $this->whenDownloadExpiresAfterExpiry($endDate,$productid,$versions,$clientid,$invoiceid);
163
+                                        $getDownload = $this->whenDownloadExpiresAfterExpiry($endDate, $productid, $versions, $clientid, $invoiceid);
164 164
                                         return $getDownload;
165 165
                                   }
166 166
                                 }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     }
175 175
 
176 176
 
177
-    public function whenDownloadTillExpiry($endDate,$productid,$versions,$clientid,$invoiceid)
177
+    public function whenDownloadTillExpiry($endDate, $productid, $versions, $clientid, $invoiceid)
178 178
     {
179 179
       if ($versions->created_at->toDateTimeString()
180 180
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         }
193 193
     }
194 194
 
195
-    public function whenDownloadExpiresAfterExpiry($endDate,$productid,$versions,$clientid,$invoiceid)
195
+    public function whenDownloadExpiresAfterExpiry($endDate, $productid, $versions, $clientid, $invoiceid)
196 196
     {
197 197
         if ($versions->created_at->toDateTimeString()
198 198
         < $endDate->ends_at->toDateTimeString()) {
@@ -236,18 +236,18 @@  discard block
 block discarded – undo
236 236
             $link = (array_slice($link, 0, 10, true));
237 237
 
238 238
             return \DataTables::of($link)
239
-                            ->addColumn('version', function ($link) {
239
+                            ->addColumn('version', function($link) {
240 240
                                 return ucfirst($link['tag_name']);
241 241
                             })
242
-                            ->addColumn('name', function ($link) {
242
+                            ->addColumn('name', function($link) {
243 243
                                 return ucfirst($link['name']);
244 244
                             })
245
-                            ->addColumn('description', function ($link) {
245
+                            ->addColumn('description', function($link) {
246 246
                                 $markdown = Markdown::convertToHtml(ucfirst($link['body']));
247 247
 
248 248
                                 return $markdown;
249 249
                             })
250
-                            ->addColumn('file', function ($link) use ($invoiceid, $productid) {
250
+                            ->addColumn('file', function($link) use ($invoiceid, $productid) {
251 251
                                 $order = Order::where('invoice_id', '=', $invoiceid)->first();
252 252
                                 $order_id = $order->id;
253 253
                                 $orderEndDate = Subscription::select('ends_at')
@@ -294,20 +294,20 @@  discard block
 block discarded – undo
294 294
             $orders = Order::where('client', \Auth::user()->id);
295 295
 
296 296
             return \DataTables::of($orders->get())
297
-                            ->addColumn('id', function ($model) {
297
+                            ->addColumn('id', function($model) {
298 298
                                 return $model->id;
299 299
                             })
300
-                            ->addColumn('product_name', function ($model) {
300
+                            ->addColumn('product_name', function($model) {
301 301
                                 return $model->product()->first()->name;
302 302
                             })
303
-                            ->addColumn('expiry', function ($model) {
303
+                            ->addColumn('expiry', function($model) {
304 304
                                 $tz = \Auth::user()->timezone()->first()->name;
305 305
                                 $end = $this->getExpiryDate($model);
306 306
 
307 307
                                 return $end;
308 308
                             })
309 309
 
310
-                            ->addColumn('Action', function ($model) {
310
+                            ->addColumn('Action', function($model) {
311 311
                                 $sub = $model->subscription()->first();
312 312
                                 $order = Order::where('id', $model->id)->select('product')->first();
313 313
                                 $productid = $order->product;
@@ -422,17 +422,17 @@  discard block
 block discarded – undo
422 422
                     ->select('id', 'invoice_id', 'user_id', 'amount', 'payment_method', 'payment_status', 'created_at');
423 423
 
424 424
             return \DataTables::of($payments->get())
425
-                            ->addColumn('checkbox', function ($model) {
425
+                            ->addColumn('checkbox', function($model) {
426 426
                                 if (\Input::get('client') != 'true') {
427 427
                                     return "<input type='checkbox' class='payment_checkbox' 
428 428
                                     value=".$model->id.' name=select[] id=check>';
429 429
                                 }
430 430
                             })
431
-                            ->addColumn('number', function ($model) {
431
+                            ->addColumn('number', function($model) {
432 432
                                 return $model->invoice()->first()->number;
433 433
                             })
434 434
                             ->addColumn('amount', 'payment_method', 'payment_status', 'created_at')
435
-                            ->addColumn('total', function ($model) {
435
+                            ->addColumn('total', function($model) {
436 436
                                 return $model->grand_total;
437 437
                             })
438 438
                             ->rawColumns(['checkbox', 'number', 'total',
@@ -459,13 +459,13 @@  discard block
 block discarded – undo
459 459
                     ->select('id', 'invoice_id', 'user_id', 'payment_method', 'payment_status', 'created_at', 'amount');
460 460
             //dd(\Input::all());
461 461
             return \DataTables::of($payments->get())
462
-                            ->addColumn('number', function ($model) {
462
+                            ->addColumn('number', function($model) {
463 463
                                 return $model->invoice()->first()->number;
464 464
                             })
465
-                              ->addColumn('total', function ($model) {
465
+                              ->addColumn('total', function($model) {
466 466
                                   return $model->amount;
467 467
                               })
468
-                               ->addColumn('created_at', function ($model) {
468
+                               ->addColumn('created_at', function($model) {
469 469
                                    $date1 = new DateTime($model->created_at);
470 470
                                    $tz = \Auth::user()->timezone()->first()->name;
471 471
                                    $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
                                         return $getDownload;
160 161
                          
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
                                         return $getDownload;
Please login to merge, or discard this patch.
app/Http/Controllers/Order/BaseOrderController.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         ]);
98 98
         $this->addOrderInvoiceRelation($invoiceid, $order->id);
99 99
         if ($this->checkOrderCreateSubscription($order->id) == true) {
100
-           $this->addSubscription($order->id, $plan_id, $version, $product);
100
+            $this->addSubscription($order->id, $plan_id, $version, $product);
101 101
         }
102 102
         $this->sendOrderMail($user_id, $order->id, $item->id);
103 103
     }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                 $user_id = $this->order->find($orderid)->client;
150 150
                 $this->subscription->create(['user_id' => $user_id,
151 151
                     'plan_id'                          => $planid, 'order_id' => $orderid, 'ends_at' => $ends_at,
152
-                     'version'                         => $version, 'product_id' =>$product, ]);
152
+                        'version'                         => $version, 'product_id' =>$product, ]);
153 153
             }
154 154
         } catch (\Exception $ex) {
155 155
             Bugsnag::notifyException($ex);
Please login to merge, or discard this patch.