Test Setup Failed
Push — development ( d24cd2...0e86e7 )
by Ashutosh
08:42
created
app/Http/Controllers/Product/BaseProductController.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,7 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
             $plan = new Plan();
128 128
             $plans = $plan->where('product', $productid)->pluck('name', 'id')->toArray();
129
-            if (count($plans) > 0) {//If Plan Exist For A product, Display Dropdown for Plans
129
+            if (count($plans) > 0) {
130
+//If Plan Exist For A product, Display Dropdown for Plans
130 131
                 $field = "<div class='col-md-4 form-group'>
131 132
                         <label class='required'>"./* @scrutinizer ignore-type */
132 133
                         \Lang::get('message.subscription').'</label>
@@ -137,7 +138,8 @@  discard block
 block discarded – undo
137 138
                             ['class' => 'form-control required', 'id' => 'plan', 'onchange' => 'getPrice(this.value)']
138 139
                         ).'
139 140
                 </div>';
140
-            } else {//If No Plan Exist For A Product
141
+            } else {
142
+//If No Plan Exist For A Product
141 143
                 $userid = $request->input('user');
142 144
                 $price = $controller->cost($productid, $userid);
143 145
             }
@@ -203,7 +205,8 @@  discard block
 block discarded – undo
203 205
 
204 206
     public function getRelease($owner, $repository, $order_id, $file)
205 207
     {
206
-        if ($owner && $repository) {//If the Product is downloaded from Github
208
+        if ($owner && $repository) {
209
+//If the Product is downloaded from Github
207 210
             $github_controller = new \App\Http\Controllers\Github\GithubController();
208 211
             $relese = $github_controller->listRepositories($owner, $repository, $order_id);
209 212
 
Please login to merge, or discard this patch.
app/Http/Controllers/Front/PageController.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
                                  style='color:white;'> </i>&nbsp;&nbsp;Edit</a>";
78 78
                         })
79 79
 
80
-                          ->rawColumns(['checkbox', 'name', 'url',  'created_at', 'action'])
80
+                            ->rawColumns(['checkbox', 'name', 'url',  'created_at', 'action'])
81 81
                         ->make(true);
82 82
         // ->searchColumns('name', 'content')
83 83
                         // ->orderColumns('name')
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
     public function getPages()
50 50
     {
51 51
         return \DataTables::of($this->page->get())
52
-                        ->addColumn('checkbox', function ($model) {
52
+                        ->addColumn('checkbox', function($model) {
53 53
                             return "<input type='checkbox' class='page_checkbox' 
54 54
                             value=".$model->id.' name=select[] id=check>';
55 55
                         })
56
-                        ->addColumn('name', function ($model) {
56
+                        ->addColumn('name', function($model) {
57 57
                             return ucfirst($model->name);
58 58
                         })
59
-                        ->addColumn('url', function ($model) {
59
+                        ->addColumn('url', function($model) {
60 60
                             return $model->url;
61 61
                         })
62
-                        ->addColumn('created_at', function ($model) {
62
+                        ->addColumn('created_at', function($model) {
63 63
                             $created = $model->created_at;
64 64
                             if ($created) {
65 65
                                 $date1 = new \DateTime($created);
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
                             return $createdate;
72 72
                         })
73 73
 
74
-                        ->addColumn('action', function ($model) {
74
+                        ->addColumn('action', function($model) {
75 75
                             return '<a href='.url('pages/'.$model->id.'/edit')
76 76
                             ." class='btn btn-sm btn-primary btn-xs'><i class='fa fa-edit'
77 77
                                  style='color:white;'> </i>&nbsp;&nbsp;Edit</a>";
78 78
                         })
79 79
 
80
-                          ->rawColumns(['checkbox', 'name', 'url',  'created_at', 'action'])
80
+                          ->rawColumns(['checkbox', 'name', 'url', 'created_at', 'action'])
81 81
                         ->make(true);
82 82
         // ->searchColumns('name', 'content')
83 83
                         // ->orderColumns('name')
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             $selectedParent = $this->page->where('id', $id)->pluck('parent_page_id')->toArray();
110 110
             $parentName = $this->page->where('id', $selectedParent)->pluck('name', 'id')->toArray();
111 111
 
112
-            return view('themes.default1.front.page.edit', compact('parents', 'page', 'default', 'selectedDefault', 'publishingDate','selectedParent',
112
+            return view('themes.default1.front.page.edit', compact('parents', 'page', 'default', 'selectedDefault', 'publishingDate', 'selectedParent',
113 113
                 'parentName'));
114 114
         } catch (\Exception $ex) {
115 115
             return redirect()->back()->with('fails', $ex->getMessage());
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
             $trasform = [];
360 360
             $templates = $this->getTemplateOne($productsRelatedToGroup, $data, $trasform);
361 361
 
362
-            return view('themes.default1.common.template.shoppingcart', compact('templates','headline','tagline'));
362
+            return view('themes.default1.common.template.shoppingcart', compact('templates', 'headline', 'tagline'));
363 363
         } catch (\Exception $ex) {
364 364
             app('log')->error($ex->getMessage());
365 365
             Bugsnag::notifyException($ex);
Please login to merge, or discard this patch.
app/Http/Controllers/Product/ProductController.php 3 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -190,7 +190,8 @@  discard block
 block discarded – undo
190 190
             $this->product_upload->save();
191 191
             $this->product->where('id', $product_id->id)->update(['version'=>$request->input('version')]);
192 192
             $autoUpdateStatus = StatusSetting::pluck('update_settings')->first();
193
-            if ($autoUpdateStatus == 1) { //If License Setting Status is on,Add Product to the License Manager
193
+            if ($autoUpdateStatus == 1) {
194
+//If License Setting Status is on,Add Product to the License Manager
194 195
                 $updateClassObj = new \App\Http\Controllers\AutoUpdate\AutoUpdateController();
195 196
                 $addProductToAutoUpdate = $updateClassObj->addNewVersion($product_id->id, $request->input('version'), $request->input('filename'), '1');
196 197
             }
@@ -280,7 +281,8 @@  discard block
 block discarded – undo
280 281
 
281 282
         try {
282 283
             $licenseStatus = StatusSetting::pluck('license_status')->first();
283
-            if ($licenseStatus == 1) { //If License Setting Status is on,Add Product to the License Manager
284
+            if ($licenseStatus == 1) {
285
+//If License Setting Status is on,Add Product to the License Manager
284 286
                 $addProductToLicensing = $this->licensing->addNewProduct($input['name'], $input['product_sku']);
285 287
             }
286 288
             $licenseCont = new \App\Http\Controllers\AutoUpdate\AutoUpdateController();
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
                             ->addColumn('name', function ($model) {
125 125
                                 return ucfirst($model->name);
126 126
                             })
127
-                              ->addColumn('image', function ($model) {
128
-                                  // return $model->image;
129
-                                  return "<img src= '$model->image' + height=\"80\"/>";
130
-                              })
127
+                                ->addColumn('image', function ($model) {
128
+                                    // return $model->image;
129
+                                    return "<img src= '$model->image' + height=\"80\"/>";
130
+                                })
131 131
                             ->addColumn('type', function ($model) {
132 132
                                 if ($this->type->where('id', $model->type)->first()) {
133 133
                                     return $this->type->where('id', $model->type)->first()->name;
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
         $this->validate(
173 173
             $request,
174 174
             [
175
-       'producttitle' => 'required',
175
+        'producttitle' => 'required',
176 176
         'version'      => 'required',
177
-       'filename'      => 'required',
178
-       ],
179
-       ['filename.required' => 'Please Uplaod A file',
177
+        'filename'      => 'required',
178
+        ],
179
+        ['filename.required' => 'Please Uplaod A file',
180 180
         ]
181 181
         );
182 182
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -117,25 +117,25 @@  discard block
 block discarded – undo
117 117
             $new_product = Product::select('id', 'name', 'type', 'image', 'group', 'image')->get();
118 118
             return\ DataTables::of($new_product)
119 119
 
120
-                            ->addColumn('checkbox', function ($model) {
120
+                            ->addColumn('checkbox', function($model) {
121 121
                                 return "<input type='checkbox' class='product_checkbox' 
122 122
                                 value=".$model->id.' name=select[] id=check>';
123 123
                             })
124
-                            ->addColumn('name', function ($model) {
124
+                            ->addColumn('name', function($model) {
125 125
                                 return ucfirst($model->name);
126 126
                             })
127
-                              ->addColumn('image', function ($model) {
127
+                              ->addColumn('image', function($model) {
128 128
                                   // return $model->image;
129 129
                                   return "<img src= '$model->image' + height=\"80\"/>";
130 130
                               })
131
-                            ->addColumn('type', function ($model) {
131
+                            ->addColumn('type', function($model) {
132 132
                                 if ($this->type->where('id', $model->type)->first()) {
133 133
                                     return $this->type->where('id', $model->type)->first()->name;
134 134
                                 } else {
135 135
                                     return 'Not available';
136 136
                                 }
137 137
                             })
138
-                            ->addColumn('group', function ($model) {
138
+                            ->addColumn('group', function($model) {
139 139
                                 if ($this->group->where('id', $model->group)->first()) {
140 140
                                     return $this->group->where('id', $model->group)->first()->name;
141 141
                                 } else {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                                 }
144 144
                             })
145 145
 
146
-                            ->addColumn('Action', function ($model) {
146
+                            ->addColumn('Action', function($model) {
147 147
                                 $permissions = LicensePermissionsController::getPermissionsForProduct($model->id);
148 148
                                 $url = '';
149 149
                                 if ($permissions['downloadPermission'] == 1) {
Please login to merge, or discard this patch.
app/Model/Common/StatusSetting.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,5 +8,5 @@
 block discarded – undo
8 8
 {
9 9
     protected $table = 'status_settings';
10 10
     public $timestamps = false;
11
-    protected $fillable = ['expiry_mail', 'activity_log_delete', 'license_status', 'github_status', 'mailchimp_status', 'twitter_status', 'msg91_status', 'emailverification_status', 'recaptcha_status', 'update_status', 'zoho_status', 'rzp_status', 'mailchimp_product_status', 'mailchimp_ispaid_status','terms'];
11
+    protected $fillable = ['expiry_mail', 'activity_log_delete', 'license_status', 'github_status', 'mailchimp_status', 'twitter_status', 'msg91_status', 'emailverification_status', 'recaptcha_status', 'update_status', 'zoho_status', 'rzp_status', 'mailchimp_product_status', 'mailchimp_ispaid_status', 'terms'];
12 12
 }
Please login to merge, or discard this patch.
app/Model/License/LicenseType.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,6 +43,6 @@
 block discarded – undo
43 43
     {
44 44
         $this->permissions()->detach();
45 45
         $this->products()->delete();
46
-         return parent::delete();
46
+            return parent::delete();
47 47
     }
48 48
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 
37 37
     public function products()
38 38
     {
39
-        return $this->hasMany('App\Model\Product\Product','type');
39
+        return $this->hasMany('App\Model\Product\Product', 'type');
40 40
     }
41 41
 
42 42
     public function delete()
Please login to merge, or discard this patch.
app/Traits/CoupCodeAndInvoiceSearch.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -374,11 +374,11 @@
 block discarded – undo
374 374
         }
375 375
     }
376 376
 
377
-    public function getCodeValue($promo,$code)
377
+    public function getCodeValue($promo, $code)
378 378
     {
379
-        if($promo && $code) {
379
+        if ($promo && $code) {
380 380
             return $promo->value;
381 381
         }
382
-        return ;
382
+        return;
383 383
     }
384 384
 }
Please login to merge, or discard this patch.
app/ApiKey.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,5 +9,5 @@
 block discarded – undo
9 9
     protected $table = 'api_keys';
10 10
     protected $fillable = ['rzp_key', 'rzp_secret', 'apilayer_key', 'bugsnag_api_key',
11 11
     'zoho_api_key', 'msg91_auth_key', 'twitter_consumer_key',
12
-    'twitter_consumer_secret', 'twitter_access_token', 'access_tooken_secret', 'license_api_secret', 'license_api_url', 'nocaptcha_sitekey', 'captcha_secretCheck', 'update_api_url', 'update_api_secret','terms_url' ];
12
+    'twitter_consumer_secret', 'twitter_access_token', 'access_tooken_secret', 'license_api_secret', 'license_api_url', 'nocaptcha_sitekey', 'captcha_secretCheck', 'update_api_url', 'update_api_secret', 'terms_url'];
13 13
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Common/BaseCronController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@
 block discarded – undo
50 50
                     array_push($sub, $this->getAllDaysSubscription($allDay));
51 51
                 }
52 52
             } elseif ($allDay == 1) {
53
-                if (count($this->get1DaysUsers())>0) {
53
+                if (count($this->get1DaysUsers()) > 0) {
54 54
                     array_push($sub, $this->get1DaysSubscription());
55 55
                 }
56 56
             } elseif ($allDay == 0) {
57
-                if (count($this->get0DaysUsers())>0) {
57
+                if (count($this->get0DaysUsers()) > 0) {
58 58
                     array_push($sub, $this->get0DaysSubscription());
59 59
                 }
60
-                if (count($this->getPlus1Users())>0) {
60
+                if (count($this->getPlus1Users()) > 0) {
61 61
                     array_push($sub, $this->getPlus1Subscription());
62 62
                 }
63 63
             }
Please login to merge, or discard this patch.
app/Http/Controllers/Order/InvoiceController.php 3 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
         $query = $this->advanceSearch($name, $invoice_no, $currency, $status, $from, $till);
130 130
 
131 131
         return \DataTables::of($query->take(100))
132
-         ->setTotalRecords($query->count())
132
+            ->setTotalRecords($query->count())
133 133
 
134
-         ->addColumn('checkbox', function ($model) {
135
-             return "<input type='checkbox' class='invoice_checkbox' 
134
+            ->addColumn('checkbox', function ($model) {
135
+                return "<input type='checkbox' class='invoice_checkbox' 
136 136
                             value=".$model->id.' name=select[] id=check>';
137
-         })
137
+            })
138 138
                         ->addColumn('user_id', function ($model) {
139 139
                             $first = $this->user->where('id', $model->user_id)->first()->first_name;
140 140
                             $last = $this->user->where('id', $model->user_id)->first()->last_name;
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 
143 143
                             return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>';
144 144
                         })
145
-                         ->addColumn('number', function ($model) {
146
-                             return ucfirst($model->number);
147
-                         })
145
+                            ->addColumn('number', function ($model) {
146
+                                return ucfirst($model->number);
147
+                            })
148 148
 
149 149
                         ->addColumn('date', function ($model) {
150 150
                             $date = ($model->created_at);
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
                             return $date;
153 153
                             // return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m');
154 154
                         })
155
-                         ->addColumn('grand_total', function ($model) {
156
-                             return $model->grand_total;
157
-                         })
158
-                          ->addColumn('status', function ($model) {
159
-                              return ucfirst($model->status);
160
-                          })
155
+                            ->addColumn('grand_total', function ($model) {
156
+                                return $model->grand_total;
157
+                            })
158
+                            ->addColumn('status', function ($model) {
159
+                                return ucfirst($model->status);
160
+                            })
161 161
 
162 162
                         ->addColumn('action', function ($model) {
163 163
                             $action = '';
@@ -175,30 +175,30 @@  discard block
 block discarded – undo
175 175
                             style='color:white;'> </i>&nbsp;&nbsp;View</a>"
176 176
                                     ."   $action";
177 177
                         })
178
-                         ->filterColumn('user_id', function ($query, $keyword) {
179
-                             $sql = 'first_name like ?';
180
-                             $query->whereRaw($sql, ["%{$keyword}%"]);
181
-                         })
178
+                            ->filterColumn('user_id', function ($query, $keyword) {
179
+                                $sql = 'first_name like ?';
180
+                                $query->whereRaw($sql, ["%{$keyword}%"]);
181
+                            })
182 182
 
183
-                          ->filterColumn('status', function ($query, $keyword) {
184
-                              $sql = 'status like ?';
185
-                              $query->whereRaw($sql, ["%{$keyword}%"]);
186
-                          })
183
+                            ->filterColumn('status', function ($query, $keyword) {
184
+                                $sql = 'status like ?';
185
+                                $query->whereRaw($sql, ["%{$keyword}%"]);
186
+                            })
187 187
 
188 188
                         ->filterColumn('number', function ($query, $keyword) {
189 189
                             $sql = 'number like ?';
190 190
                             $query->whereRaw($sql, ["%{$keyword}%"]);
191 191
                         })
192
-                         ->filterColumn('grand_total', function ($query, $keyword) {
193
-                             $sql = 'grand_total like ?';
194
-                             $query->whereRaw($sql, ["%{$keyword}%"]);
195
-                         })
196
-                          ->filterColumn('date', function ($query, $keyword) {
197
-                              $sql = 'date like ?';
198
-                              $query->whereRaw($sql, ["%{$keyword}%"]);
199
-                          })
200
-
201
-                         ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action'])
192
+                            ->filterColumn('grand_total', function ($query, $keyword) {
193
+                                $sql = 'grand_total like ?';
194
+                                $query->whereRaw($sql, ["%{$keyword}%"]);
195
+                            })
196
+                            ->filterColumn('date', function ($query, $keyword) {
197
+                                $sql = 'date like ?';
198
+                                $query->whereRaw($sql, ["%{$keyword}%"]);
199
+                            })
200
+
201
+                            ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action'])
202 202
                         ->make(true);
203 203
     }
204 204
 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
             $code = '';
271 271
             $codevalue = '';
272 272
             if(\Session::has('code')){//If coupon code is applied get it here from Session
273
-              $code = \Session::get('code');
274
-              $codevalue = \Session::get('codevalue');
273
+                $code = \Session::get('code');
274
+                $codevalue = \Session::get('codevalue');
275 275
             }
276 276
             $tax_rule = new \App\Model\Payment\TaxOption();
277 277
             $rule = $tax_rule->findOrFail(1);
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
             
298 298
             $symbol = $attributes[0]['currency']['symbol'];
299 299
             $invoice = $this->invoice->create(['user_id' => $user_id, 'number' => $number,
300
-             'date' => $date, 'discount'=>$codevalue,'grand_total' => $grand_total, 'coupon_code'=>$code,'status' => 'pending',
301
-             'currency'  => \Auth::user()->currency, ]);
300
+                'date' => $date, 'discount'=>$codevalue,'grand_total' => $grand_total, 'coupon_code'=>$code,'status' => 'pending',
301
+                'currency'  => \Auth::user()->currency, ]);
302 302
             foreach (\Cart::getContent() as $cart) {
303 303
                 $this->createInvoiceItems($invoice->id, $cart,$codevalue);
304 304
             }
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
             //     $grand_total = $total;
404 404
             // }
405 405
             $grand_total = $this->getGrandTotal($code, $total, $cost, $productid, $currency);
406
-             $promo = $this->promotion->where('code', $code)->first();
407
-             $codeValue = $this->getCodeValue($promo,$code);//get coupon code value to be added to Invoice
406
+                $promo = $this->promotion->where('code', $code)->first();
407
+                $codeValue = $this->getCodeValue($promo,$code);//get coupon code value to be added to Invoice
408 408
             $grand_total = $qty * $grand_total;
409 409
             if ($grand_total == 0) {
410 410
                 $status = 'success';
@@ -421,11 +421,11 @@  discard block
 block discarded – undo
421 421
             $grand_total = \App\Http\Controllers\Front\CartController::rounding($grand_total);
422 422
 
423 423
             $invoice = Invoice::create(['user_id' => $user_id,'number' => $number, 'date' => $date,
424
-             'coupon_code'=>$code,'discount'=>$codeValue,
424
+                'coupon_code'=>$code,'discount'=>$codeValue,
425 425
                 'grand_total' => $grand_total,  'currency'  => $currency, 'status' => $status, 'description' => $description, ]);
426 426
 
427 427
             $items = $this->createInvoiceItemsByAdmin($invoice->id, $productid,
428
-             $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate);
428
+                $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate);
429 429
             $result = $this->getMessage($items, $user_id);
430 430
         } catch (\Exception $ex) {
431 431
             app('log')->info($ex->getMessage());
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
                 } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0
502 502
 
503 503
                     $taxClassId = Tax::where('country', '')->where('state', 'Any State')
504
-                     ->pluck('tax_classes_id')->first(); //In case of India when
504
+                        ->pluck('tax_classes_id')->first(); //In case of India when
505 505
                     //other tax is available and tax is not enabled
506 506
                     if ($taxClassId) {
507 507
                         $rate = $this->getTotalRate($taxClassId, $productid, $taxs);
@@ -569,10 +569,10 @@  discard block
 block discarded – undo
569 569
         foreach ($taxes as $key => $tax) {
570 570
             if ($taxes[0]) {
571 571
                 $tax_attribute[$key] = ['name' => $tax->name, 'name1' => $name1,
572
-                 'name2'                       => $name2, 'name3' => $name3, 'name4' => $name4,
573
-                 'rate'                        => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst,
574
-                 'rate3'                       => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code,
575
-                  'origin_state'               => $origin_state, ];
572
+                    'name2'                       => $name2, 'name3' => $name3, 'name4' => $name4,
573
+                    'rate'                        => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst,
574
+                    'rate3'                       => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code,
575
+                    'origin_state'               => $origin_state, ];
576 576
 
577 577
                 $rate = $tax->rate;
578 578
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             $from = $request->input('from');
109 109
             $till = $request->input('till');
110 110
 
111
-            return view('themes.default1.invoice.index', compact('name','invoice_no','status','currencies','currency_id','from',
111
+            return view('themes.default1.invoice.index', compact('name', 'invoice_no', 'status', 'currencies', 'currency_id', 'from',
112 112
 
113 113
                 'till'));
114 114
         } catch (\Exception $ex) {
@@ -131,35 +131,35 @@  discard block
 block discarded – undo
131 131
         return \DataTables::of($query->take(100))
132 132
          ->setTotalRecords($query->count())
133 133
 
134
-         ->addColumn('checkbox', function ($model) {
134
+         ->addColumn('checkbox', function($model) {
135 135
              return "<input type='checkbox' class='invoice_checkbox' 
136 136
                             value=".$model->id.' name=select[] id=check>';
137 137
          })
138
-                        ->addColumn('user_id', function ($model) {
138
+                        ->addColumn('user_id', function($model) {
139 139
                             $first = $this->user->where('id', $model->user_id)->first()->first_name;
140 140
                             $last = $this->user->where('id', $model->user_id)->first()->last_name;
141 141
                             $id = $this->user->where('id', $model->user_id)->first()->id;
142 142
 
143 143
                             return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>';
144 144
                         })
145
-                         ->addColumn('number', function ($model) {
145
+                         ->addColumn('number', function($model) {
146 146
                              return ucfirst($model->number);
147 147
                          })
148 148
 
149
-                        ->addColumn('date', function ($model) {
149
+                        ->addColumn('date', function($model) {
150 150
                             $date = ($model->created_at);
151 151
 
152 152
                             return $date;
153 153
                             // return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m');
154 154
                         })
155
-                         ->addColumn('grand_total', function ($model) {
155
+                         ->addColumn('grand_total', function($model) {
156 156
                              return $model->grand_total;
157 157
                          })
158
-                          ->addColumn('status', function ($model) {
158
+                          ->addColumn('status', function($model) {
159 159
                               return ucfirst($model->status);
160 160
                           })
161 161
 
162
-                        ->addColumn('action', function ($model) {
162
+                        ->addColumn('action', function($model) {
163 163
                             $action = '';
164 164
 
165 165
                             $check = $this->checkExecution($model->id);
@@ -175,25 +175,25 @@  discard block
 block discarded – undo
175 175
                             style='color:white;'> </i>&nbsp;&nbsp;View</a>"
176 176
                                     ."   $action";
177 177
                         })
178
-                         ->filterColumn('user_id', function ($query, $keyword) {
178
+                         ->filterColumn('user_id', function($query, $keyword) {
179 179
                              $sql = 'first_name like ?';
180 180
                              $query->whereRaw($sql, ["%{$keyword}%"]);
181 181
                          })
182 182
 
183
-                          ->filterColumn('status', function ($query, $keyword) {
183
+                          ->filterColumn('status', function($query, $keyword) {
184 184
                               $sql = 'status like ?';
185 185
                               $query->whereRaw($sql, ["%{$keyword}%"]);
186 186
                           })
187 187
 
188
-                        ->filterColumn('number', function ($query, $keyword) {
188
+                        ->filterColumn('number', function($query, $keyword) {
189 189
                             $sql = 'number like ?';
190 190
                             $query->whereRaw($sql, ["%{$keyword}%"]);
191 191
                         })
192
-                         ->filterColumn('grand_total', function ($query, $keyword) {
192
+                         ->filterColumn('grand_total', function($query, $keyword) {
193 193
                              $sql = 'grand_total like ?';
194 194
                              $query->whereRaw($sql, ["%{$keyword}%"]);
195 195
                          })
196
-                          ->filterColumn('date', function ($query, $keyword) {
196
+                          ->filterColumn('date', function($query, $keyword) {
197 197
                               $sql = 'date like ?';
198 198
                               $query->whereRaw($sql, ["%{$keyword}%"]);
199 199
                           })
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         try {
270 270
             $code = '';
271 271
             $codevalue = '';
272
-            if(\Session::has('code')){//If coupon code is applied get it here from Session
272
+            if (\Session::has('code')) {//If coupon code is applied get it here from Session
273 273
               $code = \Session::get('code');
274 274
               $codevalue = \Session::get('codevalue');
275 275
             }
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
             
298 298
             $symbol = $attributes[0]['currency']['symbol'];
299 299
             $invoice = $this->invoice->create(['user_id' => $user_id, 'number' => $number,
300
-             'date' => $date, 'discount'=>$codevalue,'grand_total' => $grand_total, 'coupon_code'=>$code,'status' => 'pending',
300
+             'date' => $date, 'discount'=>$codevalue, 'grand_total' => $grand_total, 'coupon_code'=>$code, 'status' => 'pending',
301 301
              'currency'  => \Auth::user()->currency, ]);
302 302
             foreach (\Cart::getContent() as $cart) {
303
-                $this->createInvoiceItems($invoice->id, $cart,$codevalue);
303
+                $this->createInvoiceItems($invoice->id, $cart, $codevalue);
304 304
             }
305 305
             $this->sendMail($user_id, $invoice->id);
306 306
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
         }
314 314
     }
315 315
 
316
-    public function createInvoiceItems($invoiceid, $cart,$codevalue='')
316
+    public function createInvoiceItems($invoiceid, $cart, $codevalue = '')
317 317
     {
318 318
         try {
319 319
             $planid = 0;
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
             // }
405 405
             $grand_total = $this->getGrandTotal($code, $total, $cost, $productid, $currency);
406 406
              $promo = $this->promotion->where('code', $code)->first();
407
-             $codeValue = $this->getCodeValue($promo,$code);//get coupon code value to be added to Invoice
407
+             $codeValue = $this->getCodeValue($promo, $code); //get coupon code value to be added to Invoice
408 408
             $grand_total = $qty * $grand_total;
409 409
             if ($grand_total == 0) {
410 410
                 $status = 'success';
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
             $grand_total = $this->calculateTotal($tax_rate, $grand_total);
421 421
             $grand_total = \App\Http\Controllers\Front\CartController::rounding($grand_total);
422 422
 
423
-            $invoice = Invoice::create(['user_id' => $user_id,'number' => $number, 'date' => $date,
424
-             'coupon_code'=>$code,'discount'=>$codeValue,
425
-                'grand_total' => $grand_total,  'currency'  => $currency, 'status' => $status, 'description' => $description, ]);
423
+            $invoice = Invoice::create(['user_id' => $user_id, 'number' => $number, 'date' => $date,
424
+             'coupon_code'=>$code, 'discount'=>$codeValue,
425
+                'grand_total' => $grand_total, 'currency'  => $currency, 'status' => $status, 'description' => $description, ]);
426 426
 
427 427
             $items = $this->createInvoiceItemsByAdmin($invoice->id, $productid,
428 428
              $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate);
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -269,7 +269,8 @@  discard block
 block discarded – undo
269 269
         try {
270 270
             $code = '';
271 271
             $codevalue = '';
272
-            if(\Session::has('code')){//If coupon code is applied get it here from Session
272
+            if(\Session::has('code')) {
273
+//If coupon code is applied get it here from Session
273 274
               $code = \Session::get('code');
274 275
               $codevalue = \Session::get('codevalue');
275 276
             }
@@ -498,7 +499,8 @@  discard block
 block discarded – undo
498 499
             if ($this->tax_option->findOrFail(1)->inclusive == 0) {
499 500
                 if ($this->tax_option->findOrFail(1)->tax_enable == 1) {
500 501
                     $taxs = $this->getTaxWhenEnable($productid, $taxs[0], $userid);
501
-                } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0
502
+                } elseif ($this->tax_option->tax_enable == 0) {
503
+//if tax_enable is 0
502 504
 
503 505
                     $taxClassId = Tax::where('country', '')->where('state', 'Any State')
504 506
                      ->pluck('tax_classes_id')->first(); //In case of India when
@@ -507,13 +509,15 @@  discard block
 block discarded – undo
507 509
                         $rate = $this->getTotalRate($taxClassId, $productid, $taxs);
508 510
                         $taxs = $rate['taxes'];
509 511
                         $rate = $rate['rate'];
510
-                    } elseif ($geoip_country != 'IN') {//In case of other country
512
+                    } elseif ($geoip_country != 'IN') {
513
+//In case of other country
511 514
                         // when tax is available and tax is not enabled(Applicable
512 515
                         //when Global Tax class for any country and state is not there)
513 516
 
514 517
                         $taxClassId = Tax::where('state', $geoip_state)
515 518
                         ->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first();
516
-                        if ($taxClassId) { //if state equals the user State
519
+                        if ($taxClassId) {
520
+//if state equals the user State
517 521
                             $rate = $this->getTotalRate($taxClassId, $productid, $taxs);
518 522
                             $taxs = $rate['taxes'];
519 523
                             $rate = $rate['rate'];
@@ -555,11 +559,13 @@  discard block
 block discarded – undo
555 559
         $i_gst = 0;
556 560
         $ut_gst = 0;
557 561
         $state_code = '';
558
-        if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user
562
+        if ($user_state != '') {
563
+//Get the CGST,SGST,IGST,STATE_CODE of the user
559 564
             $tax = $this->getTaxWhenState($user_state, $productid, $origin_state);
560 565
             $taxes = $tax['taxes'];
561 566
             $value = $tax['value'];
562
-        } else {//If user from other Country
567
+        } else {
568
+//If user from other Country
563 569
             $tax = $this->getTaxWhenOtherCountry($geoip_state, $geoip_country, $productid);
564 570
             $taxes = $tax['taxes'];
565 571
             $value = $tax['value'];
Please login to merge, or discard this patch.