Test Setup Failed
Branch development (80c362)
by Ashutosh
14:59
created
app/Http/Controllers/User/SoftDeleteController.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@
 block discarded – undo
34 34
                         ->addColumn('name', function ($model) {
35 35
                             return ucfirst($model->first_name.' '.$model->last_name);
36 36
                         })
37
-                         ->addColumn('email', function ($model) {
38
-                             return $model->email;
39
-                         })
37
+                            ->addColumn('email', function ($model) {
38
+                                return $model->email;
39
+                            })
40 40
                         ->addColumn('mobile', function ($model) {
41 41
                             return $model->mobile;
42 42
                         })
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -28,44 +28,44 @@  discard block
 block discarded – undo
28 28
             ->onlyTrashed()->get();
29 29
 
30 30
         return\ DataTables::of($baseQuery)
31
-                        ->addColumn('checkbox', function ($model) {
31
+                        ->addColumn('checkbox', function($model) {
32 32
                             return "<input type='checkbox' class='user_checkbox' value=".$model->id.' name=select[] id=check>';
33 33
                         })
34
-                        ->addColumn('name', function ($model) {
34
+                        ->addColumn('name', function($model) {
35 35
                             return ucfirst($model->first_name.' '.$model->last_name);
36 36
                         })
37
-                         ->addColumn('email', function ($model) {
37
+                         ->addColumn('email', function($model) {
38 38
                              return $model->email;
39 39
                          })
40
-                        ->addColumn('mobile', function ($model) {
40
+                        ->addColumn('mobile', function($model) {
41 41
                             return $model->mobile;
42 42
                         })
43
-                        ->addColumn('country', function ($model) {
43
+                        ->addColumn('country', function($model) {
44 44
                             return ucfirst(strtolower($model->country));
45 45
                         })
46
-                        ->addColumn('company', function ($model) {
46
+                        ->addColumn('company', function($model) {
47 47
                             return $model->company;
48 48
                         })
49
-                        ->addColumn('created_at', function ($model) {
49
+                        ->addColumn('created_at', function($model) {
50 50
                             return getDateHtml($model->created_at);
51 51
                         })
52
-                        ->addColumn('active', function ($model) {
52
+                        ->addColumn('active', function($model) {
53 53
                             return $this->getActiveLabel($model->mobile_verified, $model->active, $model->is_2fa_enabled);
54 54
                         })
55
-                        ->addColumn('action', function ($model) {
55
+                        ->addColumn('action', function($model) {
56 56
                             return '<a href='.url('clients/'.$model->id.'/restore')
57 57
                             ." class='btn btn-sm btn-secondary btn-xs'".tooltip('Restore')."
58 58
                             <i class='fas fa-sync-alt' style='color:white;'> </i></a>";
59 59
                         })
60 60
 
61
-                        ->rawColumns(['checkbox', 'name', 'email',  'created_at', 'active', 'action'])
61
+                        ->rawColumns(['checkbox', 'name', 'email', 'created_at', 'active', 'action'])
62 62
                         ->make(true);
63 63
     }
64 64
 
65 65
     public function restoreUser($id)
66 66
     {
67 67
         $user = User::onlyTrashed()->find($id);
68
-        if (! is_null($user)) {
68
+        if (!is_null($user)) {
69 69
             $user->restore();
70 70
         }
71 71
 
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
     {
77 77
         try {
78 78
             $ids = $request->input('select');
79
-            if (! empty($ids)) {
79
+            if (!empty($ids)) {
80 80
                 foreach ($ids as $id) {
81 81
                     $user = User::onlyTrashed()->find($id);
82
-                    if (! is_null($user)) {
82
+                    if (!is_null($user)) {
83 83
                         $user->invoiceItem()->delete();
84 84
                         $user->orderRelation()->delete();
85 85
                         $user->invoice()->delete();
Please login to merge, or discard this patch.
app/Http/Controllers/DashboardController.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
     public function getTotalSales($allowedCurrencies)
119 119
     {
120 120
         $total = Invoice::leftJoin('payments', 'invoices.id', '=', 'payments.invoice_id')
121
-                 ->where('invoices.currency', $allowedCurrencies)
122
-                 ->where('invoices.status', '!=', 'pending')
123
-                 ->pluck('payments.amount')->all();
121
+                    ->where('invoices.currency', $allowedCurrencies)
122
+                    ->where('invoices.status', '!=', 'pending')
123
+                    ->pluck('payments.amount')->all();
124 124
         $grandTotal = array_sum($total);
125 125
 
126 126
         return $grandTotal;
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
         $yearlytotal = Invoice::leftJoin('payments', 'invoices.id', '=', 'payments.invoice_id')
139 139
                 ->whereYear('invoices.created_at', '=', $currentYear)
140 140
                 ->where('invoices.currency', $allowedCurrencies)
141
-                 ->where('invoices.status', '!=', 'pending')
142
-                 ->pluck('payments.amount')->all();
141
+                    ->where('invoices.status', '!=', 'pending')
142
+                    ->pluck('payments.amount')->all();
143 143
         $grandTotal = array_sum($yearlytotal);
144 144
 
145 145
         return $grandTotal;
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
         $total = Invoice::leftJoin('payments', 'invoices.id', '=', 'payments.invoice_id')
159 159
                 ->whereYear('invoices.created_at', '=', $currentYear)->whereMonth('invoices.created_at', '=', $currentMonth)
160 160
                 ->where('invoices.currency', $allowedCurrencies)
161
-                 ->where('invoices.status', '!=', 'pending')
162
-                 ->pluck('payments.amount')->all();
161
+                    ->where('invoices.status', '!=', 'pending')
162
+                    ->pluck('payments.amount')->all();
163 163
         $grandTotal = array_sum($total);
164 164
 
165 165
         return $grandTotal;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
         $status = $request->input('status');
65 65
         $conversionRate = $this->getConversionRate();
66 66
 
67
-        return view('themes.default1.common.dashboard', compact('allowedCurrencies1','allowedCurrencies2',
68
-            'currency1Symbol','currency2Symbol','totalSalesCurrency2', 'totalSalesCurrency1', 'yearlySalesCurrency2',
67
+        return view('themes.default1.common.dashboard', compact('allowedCurrencies1', 'allowedCurrencies2',
68
+            'currency1Symbol', 'currency2Symbol', 'totalSalesCurrency2', 'totalSalesCurrency1', 'yearlySalesCurrency2',
69 69
             'yearlySalesCurrency1', 'monthlySalesCurrency2', 'monthlySalesCurrency1', 'users', 'productSoldInLast30Days'
70
-            ,'recentOrders','subscriptions','expiredSubscriptions', 'invoices', 'allSoldProducts', 'pendingPaymentCurrency2',
70
+            ,'recentOrders', 'subscriptions', 'expiredSubscriptions', 'invoices', 'allSoldProducts', 'pendingPaymentCurrency2',
71 71
             'pendingPaymentCurrency1', 'status', 'startSubscriptionDate', 'endSubscriptionDate', 'clientsUsingOldVersion', 'getLast30DaysInstallation', 'conversionRate'));
72 72
     }
73 73
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
             ->orderBy('order_count', 'desc')
213 213
             ->orderBy('orders.created_at', 'desc')
214 214
             ->groupBy('products.id')
215
-            ->get()->map(function ($element) {
215
+            ->get()->map(function($element) {
216 216
                 $element->product_image = (new Product())->getImageAttribute($element->product_image);
217 217
                 $element->order_created_at = getTimeInLoggedInUserTimeZone($element->order_created_at);
218 218
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             ->where('orders.created_at', '>', $dateBefore)
235 235
             ->where('price_override', '>', 0)
236 236
             ->orderBy('orders.id', 'desc')
237
-            ->get()->map(function ($element) {
237
+            ->get()->map(function($element) {
238 238
                 $element->order_created_at = getDateHtml($element->order_created_at);
239 239
                 $element->client_name = $element->user ? $element->user->first_name.' '.$element->user->last_name : User::onlyTrashed()->find($element->client)->first_name.' '.User::onlyTrashed()->find($element->client)->last_name;
240 240
                 $element->client_profile_link = \Config('app.url').'/clients/'.$element->client;
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         $baseQuery = Subscription::with('user:id,first_name,last_name,email,user_name')
258 258
             ->join('orders', 'subscriptions.order_id', '=', 'orders.id')
259 259
             ->join('products', 'products.id', '=', 'orders.product')
260
-            ->select('subscriptions.id','products.id as product_id', 'orders.number as order_number', 'orders.id as order_id',
260
+            ->select('subscriptions.id', 'products.id as product_id', 'orders.number as order_number', 'orders.id as order_id',
261 261
                 'products.name as product_name', 'subscriptions.update_ends_at as subscription_ends_at', 'user_id')
262 262
             ->where('price_override', '>', 0)
263 263
             ->orderBy('subscription_ends_at', 'asc')
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
                 ->where('update_ends_at', '<=', (new Carbon('+30 days'))->toDateTimeString());
272 272
         }
273 273
 
274
-        return $baseQuery->get()->map(function ($element) {
274
+        return $baseQuery->get()->map(function($element) {
275 275
             $element->client_name = $element->user ? $element->user->first_name.' '.$element->user->last_name : User::onlyTrashed()->find($element->user_id)->first_name.' '.User::onlyTrashed()->find($element->user_id)->last_name;
276 276
             $element->client_profile_link = \Config('app.url').'/clients/'.$element->user_id;
277 277
             $element->order_link = \Config('app.url').'/orders/'.$element->order_id;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
             ->where('invoices.grand_total', '>', 0)
301 301
             ->groupBy('invoices.id')
302 302
             ->orderBy('invoices.created_at', 'desc')
303
-            ->get()->map(function ($element) {
303
+            ->get()->map(function($element) {
304 304
                 $element->balance = (int) ($element->grand_total - $element->paid);
305 305
                 $element->status = getStatusLabel($element->status);
306 306
                 $element->grand_total = currencyFormat((int) $element->grand_total, $element->currency_code);
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
             ->where('subscriptions.version', '<', $latestVersion)
336 336
             ->where('subscriptions.version', '!=', null)
337 337
             ->where('subscriptions.version', '!=', '')
338
-            ->select('orders.id', \DB::raw("concat(first_name, ' ', last_name) as client_name"), 'products.name as product_name','products.id as product_id',
338
+            ->select('orders.id', \DB::raw("concat(first_name, ' ', last_name) as client_name"), 'products.name as product_name', 'products.id as product_id',
339 339
                 'subscriptions.version as product_version', 'client as client_id', 'subscriptions.update_ends_at as subscription_ends_at')
340 340
             ->orderBy('subscription_ends_at', 'desc')
341
-            ->take(30)->get()->map(function ($element) {
341
+            ->take(30)->get()->map(function($element) {
342 342
                 $element->subscription_ends_at = $element->subscription_ends_at;
343 343
                 $appUrl = \Config::get('app.url');
344 344
                 $clientProfileUrl = $appUrl.'/clients/'.$element->client_id;
Please login to merge, or discard this patch.
app/Http/Controllers/Google2FAController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@
 block discarded – undo
206 206
 
207 207
     public function verifyRecoveryCode(Request $request)
208 208
     {
209
-        $this->validate($request,[
209
+        $this->validate($request, [
210 210
             'rec_code'=>'required',
211 211
         ],
212 212
         ['rec_code.required'=>'Plase enter recovery code',
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -214,7 +214,8 @@
 block discarded – undo
214 214
         try {
215 215
             $userId = $request->session()->pull('2fa:user:id');
216 216
             $this->user = User::findorFail($userId);
217
-            if ($this->user->code_usage_count == 1) {//If backup code is used already
217
+            if ($this->user->code_usage_count == 1) {
218
+//If backup code is used already
218 219
                 throw new \Exception('This code is already used once. Please use Authenticator app to enter the code or contact admin for disabling 2FA for your account.');
219 220
             }
220 221
             $rec_code = $request->input('rec_code');
Please login to merge, or discard this patch.
app/Http/Controllers/Jobs/QueueController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
             $allQueues = $this->queue->select('id', 'name', 'status')->get();
47 47
 
48 48
             return \DataTables::of($allQueues)
49
-        ->addColumn('name', function ($model) {
49
+        ->addColumn('name', function($model) {
50 50
             return $model->getName();
51 51
         })
52
-        ->addColumn('status', function ($model) {
52
+        ->addColumn('status', function($model) {
53 53
             return $model->getStatus();
54 54
         })
55
-        ->addColumn('action', function ($model) {
55
+        ->addColumn('action', function($model) {
56 56
             return $model->getAction();
57 57
         })
58 58
         ->rawColumns(['checkbox', 'name', 'status', 'action'])
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         try {
71 71
             $queues = new QueueService();
72 72
             $queue = $queues->find($id);
73
-            if (! $queue) {
73
+            if (!$queue) {
74 74
                 throw new Exception('Sorry we can not find your request');
75 75
             }
76 76
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
             $queues = new QueueService();
88 88
             $queue = $queues->find($id);
89 89
 
90
-            if (! $queue) {
90
+            if (!$queue) {
91 91
                 throw new Exception('Sorry we can not find your request');
92 92
             }
93 93
             $setting = new FaveoQueue();
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
             return $form;
204 204
         case 'redis':
205
-            if (! extension_loaded('redis')) {
205
+            if (!extension_loaded('redis')) {
206 206
                 return errorResponse(\Lang::get('message.extension_required_error', ['extension' => 'redis']), 500);
207 207
             }
208 208
             $form .= "<div class='row'>";
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
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
                                  style='color:white;'> </i></a>";
54 54
                         })
55 55
 
56
-                          ->rawColumns(['checkbox', 'name', 'url',  'created_at', 'action'])
56
+                            ->rawColumns(['checkbox', 'name', 'url',  'created_at', 'action'])
57 57
                         ->make(true);
58 58
         // ->searchColumns('name', 'content')
59 59
                         // ->orderColumns('name')
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,27 +33,27 @@  discard block
 block discarded – undo
33 33
     public function getPages()
34 34
     {
35 35
         return \DataTables::of($this->page->get())
36
-                        ->addColumn('checkbox', function ($model) {
36
+                        ->addColumn('checkbox', function($model) {
37 37
                             return "<input type='checkbox' class='page_checkbox' 
38 38
                             value=".$model->id.' name=select[] id=check>';
39 39
                         })
40
-                        ->addColumn('name', function ($model) {
40
+                        ->addColumn('name', function($model) {
41 41
                             return ucfirst($model->name);
42 42
                         })
43
-                        ->addColumn('url', function ($model) {
43
+                        ->addColumn('url', function($model) {
44 44
                             return $model->url;
45 45
                         })
46
-                        ->addColumn('created_at', function ($model) {
46
+                        ->addColumn('created_at', function($model) {
47 47
                             return getDateHtml($model->created_at);
48 48
                         })
49 49
 
50
-                        ->addColumn('action', function ($model) {
50
+                        ->addColumn('action', function($model) {
51 51
                             return '<a href='.url('pages/'.$model->id.'/edit')
52 52
                             ." class='btn btn-sm btn-secondary btn-xs'".tooltip('Edit')."<i class='fa fa-edit'
53 53
                                  style='color:white;'> </i></a>";
54 54
                         })
55 55
 
56
-                          ->rawColumns(['checkbox', 'name', 'url',  'created_at', 'action'])
56
+                          ->rawColumns(['checkbox', 'name', 'url', 'created_at', 'action'])
57 57
                         ->make(true);
58 58
         // ->searchColumns('name', 'content')
59 59
                         // ->orderColumns('name')
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             $selectedParent = $this->page->where('id', $id)->pluck('parent_page_id')->toArray();
86 86
             $parentName = $this->page->where('id', $selectedParent)->pluck('name', 'id')->toArray();
87 87
 
88
-            return view('themes.default1.front.page.edit', compact('parents', 'page', 'selectedDefault', 'publishingDate','selectedParent',
88
+            return view('themes.default1.front.page.edit', compact('parents', 'page', 'selectedDefault', 'publishingDate', 'selectedParent',
89 89
                 'parentName'));
90 90
         } catch (\Exception $ex) {
91 91
             return redirect()->back()->with('fails', $ex->getMessage());
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         try {
224 224
             $ids = $request->input('select');
225 225
             $defaultPageId = DefaultPage::pluck('page_id')->first();
226
-            if (! empty($ids)) {
226
+            if (!empty($ids)) {
227 227
                 foreach ($ids as $id) {
228 228
                     if ($id != $defaultPageId) {
229 229
                         $page = $this->page->where('id', $id)->first();
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
         try {
325 325
             $currency = userCurrency();
326 326
             \Session::put('currency', $currency);
327
-            if (! \Session::has('currency')) {
327
+            if (!\Session::has('currency')) {
328 328
                 \Session::put('currency', 'INR');
329 329
             }
330 330
             $data = PricingTemplate::find($templateid)->data;
Please login to merge, or discard this patch.
app/Http/Controllers/Front/WidgetController.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@
 block discarded – undo
31 31
     public function getPages()
32 32
     {
33 33
         return \DataTables::of($this->widget->get())
34
-                       ->addColumn('checkbox', function ($model) {
35
-                           return "<input type='checkbox' class='widget_checkbox' 
34
+                        ->addColumn('checkbox', function ($model) {
35
+                            return "<input type='checkbox' class='widget_checkbox' 
36 36
                             value=".$model->id.' name=select[] id=check>';
37
-                       })
38
-                          ->addColumn('name', function ($model) {
39
-                              return ucfirst($model->name);
40
-                          })
37
+                        })
38
+                            ->addColumn('name', function ($model) {
39
+                                return ucfirst($model->name);
40
+                            })
41 41
                             ->addColumn('type', function ($model) {
42 42
                                 return $model->type;
43 43
                             })
44
-                              ->addColumn('created_at', function ($model) {
45
-                                  return getDateHtml($model->created_at);
46
-                              })
44
+                                ->addColumn('created_at', function ($model) {
45
+                                    return getDateHtml($model->created_at);
46
+                                })
47 47
                         // ->showColumns('name', 'type', 'created_at')
48 48
                         ->addColumn('content', function ($model) {
49 49
                             return str_limit($model->content, 10, '...');
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,24 +31,24 @@  discard block
 block discarded – undo
31 31
     public function getPages()
32 32
     {
33 33
         return \DataTables::of($this->widget->get())
34
-                       ->addColumn('checkbox', function ($model) {
34
+                       ->addColumn('checkbox', function($model) {
35 35
                            return "<input type='checkbox' class='widget_checkbox' 
36 36
                             value=".$model->id.' name=select[] id=check>';
37 37
                        })
38
-                          ->addColumn('name', function ($model) {
38
+                          ->addColumn('name', function($model) {
39 39
                               return ucfirst($model->name);
40 40
                           })
41
-                            ->addColumn('type', function ($model) {
41
+                            ->addColumn('type', function($model) {
42 42
                                 return $model->type;
43 43
                             })
44
-                              ->addColumn('created_at', function ($model) {
44
+                              ->addColumn('created_at', function($model) {
45 45
                                   return getDateHtml($model->created_at);
46 46
                               })
47 47
                         // ->showColumns('name', 'type', 'created_at')
48
-                        ->addColumn('content', function ($model) {
48
+                        ->addColumn('content', function($model) {
49 49
                             return str_limit($model->content, 10, '...');
50 50
                         })
51
-                        ->addColumn('action', function ($model) {
51
+                        ->addColumn('action', function($model) {
52 52
                             return '<a href='.url('widgets/'.$model->id.'/edit')."
53 53
                              class='btn btn-sm btn-secondary btn-xs'".tooltip('Edit')."<i class='fa fa-edit'
54 54
                                  style='color:white;'> </i></a>";
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     {
129 129
         try {
130 130
             $ids = $request->input('select');
131
-            if (! empty($ids)) {
131
+            if (!empty($ids)) {
132 132
                 foreach ($ids as $id) {
133 133
                     $widget = $this->widget->where('id', $id)->first();
134 134
                     if ($widget) {
Please login to merge, or discard this patch.
app/Http/Controllers/Front/InfoController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 
28 28
     public function payment($payment_method, $status)
29 29
     {
30
-        if (! $payment_method) {
30
+        if (!$payment_method) {
31 31
             $payment_method = '';
32 32
             $status = 'success';
33 33
         }
Please login to merge, or discard this patch.
app/Http/Controllers/Front/CheckoutController.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function checkoutForm(Request $request)
84 84
     {
85
-        if (! \Auth::user()) {//If User is not Logged in then send him to login Page
85
+        if (!\Auth::user()) {//If User is not Logged in then send him to login Page
86 86
             $url = $request->segments(); //The requested url (chekout).Save it in Session
87 87
             \Session::put('session-url', $url[0]);
88 88
             $content = Cart::getContent();
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                     $items = $invoice->invoiceItem()->get();
227 227
                     $url = '';
228 228
                     $this->checkoutAction($invoice); //For free product generate invoice without payment
229
-                    $url = view('themes.default1.front.postCheckoutTemplate', compact('invoice', 'date', 'product', 'items', ))->render();
229
+                    $url = view('themes.default1.front.postCheckoutTemplate', compact('invoice', 'date', 'product', 'items',))->render();
230 230
                     // }
231 231
                     \Cart::clear();
232 232
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
                     $items = $invoice->invoiceItem()->get();
248 248
                     $url = '';
249 249
                     $this->checkoutAction($invoice); //For free product generate invoice without payment
250
-                    $url = view('themes.default1.front.postCheckoutTemplate', compact('invoice', 'date', 'product', 'items', ))->render();
250
+                    $url = view('themes.default1.front.postCheckoutTemplate', compact('invoice', 'date', 'product', 'items',))->render();
251 251
                     \Cart::clear();
252 252
 
253 253
                     return redirect('checkout')->with('success', $url);
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -82,7 +82,8 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function checkoutForm(Request $request)
84 84
     {
85
-        if (! \Auth::user()) {//If User is not Logged in then send him to login Page
85
+        if (! \Auth::user()) {
86
+//If User is not Logged in then send him to login Page
86 87
             $url = $request->segments(); //The requested url (chekout).Save it in Session
87 88
             \Session::put('session-url', $url[0]);
88 89
             $content = Cart::getContent();
@@ -97,7 +98,8 @@  discard block
 block discarded – undo
97 98
             return redirect('login')->with('fails', 'Please login');
98 99
         }
99 100
 
100
-        if (\Cart::isEmpty()) {//During renewal when payment fails due to some reason
101
+        if (\Cart::isEmpty()) {
102
+//During renewal when payment fails due to some reason
101 103
             $invoice = \Session::get('invoice');
102 104
             if ($invoice && \Session::has('fails')) {
103 105
                 return redirect('paynow/'.$invoice->id)->with('fails', 'Payment cannot be processed. Please try the other gateway.');
@@ -110,7 +112,8 @@  discard block
 block discarded – undo
110 112
         $content = Cart::getContent();
111 113
         try {
112 114
             $domain = $request->input('domain');
113
-            if ($domain) {//Store the Domain  in session when user Logged In
115
+            if ($domain) {
116
+//Store the Domain  in session when user Logged In
114 117
                 foreach ($domain as $key => $value) {
115 118
                     \Session::put('domain'.$key, $value);
116 119
                 }
@@ -135,7 +138,8 @@  discard block
 block discarded – undo
135 138
     public function getAttributes($content)
136 139
     {
137 140
         try {
138
-            if (count($content) > 0) {//after ProductPurchase this is not true as cart is cleared
141
+            if (count($content) > 0) {
142
+//after ProductPurchase this is not true as cart is cleared
139 143
                 foreach ($content as $item) {
140 144
                     $cart_currency = $item->attributes->currency; //Get the currency of Product in the cart
141 145
                     $currency = \Auth::user()->currency != $cart_currency ? \Auth::user()->currency : $cart_currency; //If User Currency and cart currency are different the currency es set to user currency.
@@ -176,7 +180,8 @@  discard block
 block discarded – undo
176 180
             if ($invoice->user_id != \Auth::user()->id) {
177 181
                 throw new \Exception('Cannot initiate payment. Invalid modification of data');
178 182
             }
179
-            if (count($invoice->payment()->get())) {//If partial payment is made
183
+            if (count($invoice->payment()->get())) {
184
+//If partial payment is made
180 185
                 $paid = array_sum($invoice->payment()->pluck('amount')->toArray());
181 186
                 $invoice->grand_total = $invoice->grand_total - $paid;
182 187
             }
@@ -215,10 +220,12 @@  discard block
 block discarded – undo
215 220
             $paynow = $this->checkregularPaymentOrRenewal($request->input('invoice_id'));
216 221
             $cost = $request->input('cost');
217 222
             $state = $this->getState();
218
-            if ($paynow === false) {//When regular payment
223
+            if ($paynow === false) {
224
+//When regular payment
219 225
                 $invoice = $invoice_controller->generateInvoice();
220 226
                 $amount = intval(Cart::getSubTotal());
221
-                if ($amount) {//If payment is for paid product
227
+                if ($amount) {
228
+//If payment is for paid product
222 229
                     \Event::dispatch(new \App\Events\PaymentGateway(['request' => $request, 'invoice' => $invoice]));
223 230
                 } else {
224 231
                     $date = getDateHtml($invoice->date);
@@ -232,11 +239,13 @@  discard block
 block discarded – undo
232 239
 
233 240
                     return redirect('checkout')->with('success', $url);
234 241
                 }
235
-            } else {//When renewal, pending payments
242
+            } else {
243
+//When renewal, pending payments
236 244
                 $invoiceid = $request->input('invoice_id');
237 245
                 $invoice = $this->invoice->find($invoiceid);
238 246
                 $amount = intval($invoice->grand_total);
239
-                if ($amount) {//If payment is for paid product
247
+                if ($amount) {
248
+//If payment is for paid product
240 249
                     \Event::dispatch(new \App\Events\PaymentGateway(['request' => $request, 'invoice' => $invoice]));
241 250
                 } else {
242 251
                     $control = new \App\Http\Controllers\Order\RenewController();
Please login to merge, or discard this patch.
app/Http/Controllers/Front/CartController.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                 Session::put('plan', $plan);
72 72
             }
73 73
             $id = $request->input('id');
74
-            if (! property_exists($id, Cart::getContent())) {
74
+            if (!property_exists($id, Cart::getContent())) {
75 75
                 $items = $this->addProduct($id);
76 76
                 \Cart::add($items); //Add Items To the Cart Collection
77 77
             }
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
             $cost = 0;
225 225
             $months = 0;
226 226
             $currency = userCurrency($userid);
227
-            if (! $planid) {//When Product Is Added from Cart
227
+            if (!$planid) {//When Product Is Added from Cart
228 228
                 $planid = Plan::where('product', $productid)->pluck('id')->first();
229
-            } elseif (checkPlanSession() && ! $planid) {
229
+            } elseif (checkPlanSession() && !$planid) {
230 230
                 $planid = Session::get('plan');
231 231
             }
232 232
             $plan = Plan::where('id', $planid)->where('product', $productid)->first();
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -66,7 +66,8 @@  discard block
 block discarded – undo
66 66
     {
67 67
         try {
68 68
             $plan = '';
69
-            if ($request->has('subscription')) {//put he Plan id sent into session variable
69
+            if ($request->has('subscription')) {
70
+//put he Plan id sent into session variable
70 71
                 $plan = $request->get('subscription');
71 72
                 Session::put('plan', $plan);
72 73
             }
@@ -104,7 +105,8 @@  discard block
 block discarded – undo
104 105
             $planid = checkPlanSession() ? Session::get('plan') : Plan::where('product', $id)->pluck('id')->first(); //Get Plan id From Session
105 106
             $product = Product::find($id);
106 107
             $plan = $product->planRelation->find($planid);
107
-            if ($plan) { //If Plan For a Product exists
108
+            if ($plan) {
109
+//If Plan For a Product exists
108 110
                 $quantity = $plan->planPrice->first()->product_quantity;
109 111
                 //If Product quantity is null(when show agent in Product Seting Selected),then set quantity as 1;
110 112
                 $qty = $quantity != null ? $quantity : 1;
@@ -136,7 +138,8 @@  discard block
 block discarded – undo
136 138
             foreach ($cartCollection as $item) {
137 139
                 $cart_currency = $item->attributes->currency;
138 140
                 \Session::put('currency', $cart_currency);
139
-                if (\Auth::user()) {//If User is Logged in and his currency changes after logging in then remove his previous order from cart
141
+                if (\Auth::user()) {
142
+//If User is Logged in and his currency changes after logging in then remove his previous order from cart
140 143
                     $currency = \Auth::user()->currency;
141 144
                     if ($cart_currency != $currency) {
142 145
                         $id = $item->id;
@@ -224,19 +227,22 @@  discard block
 block discarded – undo
224 227
             $cost = 0;
225 228
             $months = 0;
226 229
             $currency = userCurrency($userid);
227
-            if (! $planid) {//When Product Is Added from Cart
230
+            if (! $planid) {
231
+//When Product Is Added from Cart
228 232
                 $planid = Plan::where('product', $productid)->pluck('id')->first();
229 233
             } elseif (checkPlanSession() && ! $planid) {
230 234
                 $planid = Session::get('plan');
231 235
             }
232 236
             $plan = Plan::where('id', $planid)->where('product', $productid)->first();
233
-            if ($plan) { //Get the Total Plan Cost if the Plan Exists For a Product
237
+            if ($plan) {
238
+//Get the Total Plan Cost if the Plan Exists For a Product
234 239
                 $months = 1;
235 240
                 $currency = userCurrency($userid);
236 241
                 $product = Product::find($productid);
237 242
                 $days = $plan->periods->pluck('days')->first();
238 243
                 $price = ($product->planRelation->find($planid)->planPrice->where('currency', $currency['currency'])->first()->add_price);
239
-                if ($days) { //If Period Is defined for a Particular Plan ie no. of Days Generated
244
+                if ($days) {
245
+//If Period Is defined for a Particular Plan ie no. of Days Generated
240 246
                     $months = $days >= '365' ? $days / 30 / 12 : $days / 30;
241 247
                 }
242 248
                 $finalPrice = str_replace(',', '', $price);
Please login to merge, or discard this patch.