| @@ -15,46 +15,46 @@ discard block | ||
| 15 | 15 |          $invoices = $invoice->where('user_id', $id)->orderBy('created_at', 'desc')->get(); | 
| 16 | 16 | |
| 17 | 17 | return\ DataTables::of($invoices) | 
| 18 | -                        ->addColumn('checkbox', function ($model) { | |
| 18 | +                        ->addColumn('checkbox', function($model) { | |
| 19 | 19 | return "<input type='checkbox' class='invoice_checkbox' | 
| 20 | 20 | value=".$model->id.' name=select[] id=check>'; | 
| 21 | 21 | }) | 
| 22 | -                        ->addColumn('date', function ($model) use ($client) { | |
| 22 | +                        ->addColumn('date', function($model) use ($client) { | |
| 23 | 23 | $date1 = new \DateTime($model->date); | 
| 24 | 24 | $tz = $client->timezone()->first()->name; | 
| 25 | 25 | $date1->setTimezone(new \DateTimeZone($tz)); | 
| 26 | 26 |                              $date = $date1->format('M j, Y, g:i a '); | 
| 27 | 27 | return $date; | 
| 28 | 28 | }) | 
| 29 | -                        ->addColumn('invoice_no', function ($model) { | |
| 29 | +                        ->addColumn('invoice_no', function($model) { | |
| 30 | 30 |                              return  	'<a href='.url('invoices/show?invoiceid='.$model->id).'>'.$model->number.'</a>'; | 
| 31 | 31 | }) | 
| 32 | -                        ->addColumn('total', function ($model) use ($client) { | |
| 33 | - return currency_format($model->grand_total, $code =$client->currency); | |
| 32 | +                        ->addColumn('total', function($model) use ($client) { | |
| 33 | + return currency_format($model->grand_total, $code = $client->currency); | |
| 34 | 34 | }) | 
| 35 | -                         ->addColumn('paid', function ($model) use ($client) { | |
| 35 | +                         ->addColumn('paid', function($model) use ($client) { | |
| 36 | 36 |                               $payment = \App\Model\Order\Payment::where('invoice_id', $model->id)->select('amount')->get(); | 
| 37 | - $c=count($payment); | |
| 37 | + $c = count($payment); | |
| 38 | 38 | $sum = 0; | 
| 39 | -                             for ($i=0 ;  $i <= $c-1 ; $i++) { | |
| 39 | +                             for ($i = 0; $i <= $c - 1; $i++) { | |
| 40 | 40 | $sum = $sum + $payment[$i]->amount; | 
| 41 | 41 | } | 
| 42 | - return currency_format($sum, $code =$client->currency); | |
| 42 | + return currency_format($sum, $code = $client->currency); | |
| 43 | 43 | }) | 
| 44 | -                         ->addColumn('balance', function ($model) use ($client) { | |
| 44 | +                         ->addColumn('balance', function($model) use ($client) { | |
| 45 | 45 |                               $payment = \App\Model\Order\Payment::where('invoice_id', $model->id)->select('amount')->get(); | 
| 46 | - $c=count($payment); | |
| 46 | + $c = count($payment); | |
| 47 | 47 | $sum = 0; | 
| 48 | -                             for ($i=0 ;  $i <= $c-1 ; $i++) { | |
| 48 | +                             for ($i = 0; $i <= $c - 1; $i++) { | |
| 49 | 49 | $sum = $sum + $payment[$i]->amount; | 
| 50 | 50 | } | 
| 51 | - $pendingAmount = ($model->grand_total)-($sum); | |
| 52 | - return currency_format($pendingAmount, $code =$client->currency); | |
| 51 | + $pendingAmount = ($model->grand_total) - ($sum); | |
| 52 | + return currency_format($pendingAmount, $code = $client->currency); | |
| 53 | 53 | }) | 
| 54 | -                          ->addColumn('status', function ($model) { | |
| 54 | +                          ->addColumn('status', function($model) { | |
| 55 | 55 | return $model->status; | 
| 56 | 56 | }) | 
| 57 | -                        ->addColumn('action', function ($model) { | |
| 57 | +                        ->addColumn('action', function($model) { | |
| 58 | 58 | $action = ''; | 
| 59 | 59 | $cont = new \App\Http\Controllers\Order\TaxRatesAndCodeExpiryController(); | 
| 60 | 60 | $check = $cont->checkExecution($model->id); | 
| @@ -74,7 +74,7 @@ discard block | ||
| 74 | 74 | style='color:white;'> </i>  View</a>" | 
| 75 | 75 | ." $editAction $action"; | 
| 76 | 76 | }) | 
| 77 | - ->rawColumns(['checkbox', 'date', 'invoice_no', 'total', 'paid', 'balance', 'status','action']) | |
| 77 | + ->rawColumns(['checkbox', 'date', 'invoice_no', 'total', 'paid', 'balance', 'status', 'action']) | |
| 78 | 78 | ->make(true); | 
| 79 | 79 | } | 
| 80 | 80 | |
| @@ -85,33 +85,33 @@ discard block | ||
| 85 | 85 |          $order = $client->order()->orderBy('created_at', 'desc')->get(); | 
| 86 | 86 | |
| 87 | 87 | return\ DataTables::of($order) | 
| 88 | -                        ->addColumn('checkbox', function ($model) { | |
| 88 | +                        ->addColumn('checkbox', function($model) { | |
| 89 | 89 | return "<input type='checkbox' class='order_checkbox' | 
| 90 | 90 | value=".$model->id.' name=select[] id=checkorder>'; | 
| 91 | 91 | }) | 
| 92 | -                        ->addColumn('date', function ($model) { | |
| 92 | +                        ->addColumn('date', function($model) { | |
| 93 | 93 | return ucfirst($model->created_at); | 
| 94 | 94 | }) | 
| 95 | -                        ->addColumn('product', function ($model) { | |
| 95 | +                        ->addColumn('product', function($model) { | |
| 96 | 96 | $productName = $model->product()->first() && $model->product()->first()->name ? | 
| 97 | 97 | $model->product()->first()->name : 'Unknown'; | 
| 98 | 98 | |
| 99 | 99 | return $productName; | 
| 100 | 100 | }) | 
| 101 | -                        ->addColumn('number', function ($model) { | |
| 102 | - $number= $model->number; | |
| 101 | +                        ->addColumn('number', function($model) { | |
| 102 | + $number = $model->number; | |
| 103 | 103 | |
| 104 | 104 | return ($number); | 
| 105 | 105 | }) | 
| 106 | -                         ->addColumn('total', function ($model) use ($client) { | |
| 106 | +                         ->addColumn('total', function($model) use ($client) { | |
| 107 | 107 | $price = currency_format($model->price_override, $code = $client->currency); | 
| 108 | 108 | return $price; | 
| 109 | 109 | }) | 
| 110 | -                         ->addColumn('status', function ($model) { | |
| 110 | +                         ->addColumn('status', function($model) { | |
| 111 | 111 | $status = $model->order_status; | 
| 112 | 112 | return $status; | 
| 113 | 113 | }) | 
| 114 | -                        ->addColumn('action', function ($model) { | |
| 114 | +                        ->addColumn('action', function($model) { | |
| 115 | 115 |                              return '<a href='.url('orders/'.$model->id)."  | 
| 116 | 116 | class='btn btn-sm btn-primary btn-xs'><i class='fa fa-eye' | 
| 117 | 117 | style='color:white;'> </i>  View</a>"; | 
| @@ -128,14 +128,14 @@ discard block | ||
| 128 | 128 | $extraAmt = $this->getExtraAmtPaid($id); | 
| 129 | 129 | |
| 130 | 130 | return\ DataTables::of($payments) | 
| 131 | -                        ->addColumn('checkbox', function ($model) { | |
| 131 | +                        ->addColumn('checkbox', function($model) { | |
| 132 | 132 | return "<input type='checkbox' class='payment_checkbox' | 
| 133 | 133 | value=".$model->id.' name=select[] id=checkpayment>'; | 
| 134 | 134 | }) | 
| 135 | -                        ->addColumn('invoice_no', function ($model) { | |
| 135 | +                        ->addColumn('invoice_no', function($model) { | |
| 136 | 136 | return $model->invoice()->first() ? $model->invoice()->first()->number : '--'; | 
| 137 | 137 | }) | 
| 138 | -                        ->addColumn('date', function ($model) { | |
| 138 | +                        ->addColumn('date', function($model) { | |
| 139 | 139 | $date = $model->created_at; | 
| 140 | 140 | $date1 = new \DateTime($date); | 
| 141 | 141 | $tz = \Auth::user()->timezone()->first()->name; | 
| @@ -143,11 +143,11 @@ discard block | ||
| 143 | 143 |                              $date = $date1->format('M j, Y, g:i a '); | 
| 144 | 144 | return $date; | 
| 145 | 145 | }) | 
| 146 | -                        ->addColumn('payment_method', function ($model) { | |
| 146 | +                        ->addColumn('payment_method', function($model) { | |
| 147 | 147 | return $model->payment_method; | 
| 148 | 148 | ; | 
| 149 | 149 | }) | 
| 150 | -                         ->addColumn('total', function ($model) use ($client,$extraAmt) { | |
| 150 | +                         ->addColumn('total', function($model) use ($client, $extraAmt) { | |
| 151 | 151 |                               if ($model->invoice_id == 0) { | 
| 152 | 152 | $amount = currency_format($extraAmt, $code = $client->currency); | 
| 153 | 153 |                               } else { | 
| @@ -155,7 +155,7 @@ discard block | ||
| 155 | 155 | } | 
| 156 | 156 | return $amount; | 
| 157 | 157 | }) | 
| 158 | -                         ->addColumn('status', function ($model) { | |
| 158 | +                         ->addColumn('status', function($model) { | |
| 159 | 159 | return ucfirst($model->payment_status); | 
| 160 | 160 | }) | 
| 161 | 161 | |
| @@ -318,7 +318,7 @@ | ||
| 318 | 318 |              $states = \App\Model\Common\State::where('country_code_char2', $id) | 
| 319 | 319 |              ->orderBy('state_subdivision_name', 'asc')->get(); | 
| 320 | 320 | |
| 321 | -            if (count($states)>0) { | |
| 321 | +            if (count($states) > 0) { | |
| 322 | 322 | echo '<option value="">Choose</option>'; | 
| 323 | 323 |                  foreach ($states as $stateList) { | 
| 324 | 324 | echo '<option value='.$stateList->state_subdivision_code.'>' | 
| @@ -21,17 +21,17 @@ | ||
| 21 | 21 | |
| 22 | 22 | $url_info = parse_url($url); | 
| 23 | 23 | $domain1 = $url_info['host']; | 
| 24 | -            $url = preg_replace('#^www\.(.+\.)#i', '$1', $url_info['host']);//remove www from domain | |
| 24 | +            $url = preg_replace('#^www\.(.+\.)#i', '$1', $url_info['host']); //remove www from domain | |
| 25 | 25 | $domain2 = 'www.'.$url; | 
| 26 | 26 | $domain1check = $url.','.$domain2; | 
| 27 | 27 | $orders = new Order(); | 
| 28 | 28 |              $order = $orders->where('domain', $domain1check)->orWhere('domain', $url)->orWhere('domain', $domain2)->first(); | 
| 29 | 29 |              if ($order) { | 
| 30 | -                $product = Product::where('id',$order->product)->pluck('name')->first(); | |
| 30 | +                $product = Product::where('id', $order->product)->pluck('name')->first(); | |
| 31 | 31 | $result = 'success'; | 
| 32 | 32 | } | 
| 33 | 33 | |
| 34 | -            return response()->json(compact('result','product')); | |
| 34 | +            return response()->json(compact('result', 'product')); | |
| 35 | 35 |          } catch (Exception $ex) { | 
| 36 | 36 | $error = $ex->getMessage(); | 
| 37 | 37 | |
| @@ -118,18 +118,18 @@ discard block | ||
| 118 | 118 | |
| 119 | 119 | return\ DataTables::of($new_product) | 
| 120 | 120 | |
| 121 | -                            ->addColumn('checkbox', function ($model) { | |
| 121 | +                            ->addColumn('checkbox', function($model) { | |
| 122 | 122 | return "<input type='checkbox' class='product_checkbox' | 
| 123 | 123 | value=".$model->id.' name=select[] id=check>'; | 
| 124 | 124 | }) | 
| 125 | -                            ->addColumn('name', function ($model) { | |
| 125 | +                            ->addColumn('name', function($model) { | |
| 126 | 126 | return ucfirst($model->name); | 
| 127 | 127 | }) | 
| 128 | -                              ->addColumn('image', function ($model) { | |
| 128 | +                              ->addColumn('image', function($model) { | |
| 129 | 129 | // return $model->image; | 
| 130 | 130 | return "<img src= '$model->image' + height=\"80\"/>"; | 
| 131 | 131 | }) | 
| 132 | -                            ->addColumn('type', function ($model) { | |
| 132 | +                            ->addColumn('type', function($model) { | |
| 133 | 133 |                                  if ($this->type->where('id', $model->type)->first()) { | 
| 134 | 134 |                                      return $this->type->where('id', $model->type)->first()->name; | 
| 135 | 135 |                                  } else { | 
| @@ -137,7 +137,7 @@ discard block | ||
| 137 | 137 | } | 
| 138 | 138 | }) | 
| 139 | 139 | |
| 140 | -                            ->addColumn('group', function ($model) { | |
| 140 | +                            ->addColumn('group', function($model) { | |
| 141 | 141 |                                  if ($this->group->where('id', $model->group)->first()) { | 
| 142 | 142 |                                      return $this->group->where('id', $model->group)->first()->name; | 
| 143 | 143 |                                  } else { | 
| @@ -145,7 +145,7 @@ discard block | ||
| 145 | 145 | } | 
| 146 | 146 | }) | 
| 147 | 147 | |
| 148 | -                            ->addColumn('Action', function ($model) { | |
| 148 | +                            ->addColumn('Action', function($model) { | |
| 149 | 149 | $permissions = LicensePermissionsController::getPermissionsForProduct($model->id); | 
| 150 | 150 | $url = ''; | 
| 151 | 151 |                                  if ($permissions['downloadPermission'] == 1) { | 
| @@ -192,7 +192,7 @@ discard block | ||
| 192 | 192 |              $autoUpdateStatus = StatusSetting::pluck('update_settings')->first(); | 
| 193 | 193 |              if ($autoUpdateStatus == 1) { //If License Setting Status is on,Add Product to the License Manager | 
| 194 | 194 | $updateClassObj = new \App\Http\Controllers\AutoUpdate\AutoUpdateController(); | 
| 195 | -                $addProductToAutoUpdate = $updateClassObj->addNewVersion($product_id->id, $request->input('version'),$request->input('filename'), '1'); | |
| 195 | +                $addProductToAutoUpdate = $updateClassObj->addNewVersion($product_id->id, $request->input('version'), $request->input('filename'), '1'); | |
| 196 | 196 | } | 
| 197 | 197 | $response = ['success'=>'true', 'message'=>'Product Uploaded Successfully']; | 
| 198 | 198 | |
| @@ -117,18 +117,18 @@ discard block | ||
| 117 | 117 | public function getTemplates() | 
| 118 | 118 |      { | 
| 119 | 119 |          return \DataTables::of($this->template->select('id', 'name', 'type')->get()) | 
| 120 | -                        ->addColumn('checkbox', function ($model) { | |
| 120 | +                        ->addColumn('checkbox', function($model) { | |
| 121 | 121 | return "<input type='checkbox' class='template_checkbox' | 
| 122 | 122 | value=".$model->id.' name=select[] id=check>'; | 
| 123 | 123 | }) | 
| 124 | 124 | |
| 125 | -                         ->addColumn('name', function ($model) { | |
| 125 | +                         ->addColumn('name', function($model) { | |
| 126 | 126 | return $model->name; | 
| 127 | 127 | }) | 
| 128 | -                        ->addColumn('type', function ($model) { | |
| 128 | +                        ->addColumn('type', function($model) { | |
| 129 | 129 |                              return $this->type->where('id', $model->type)->first()->name; | 
| 130 | 130 | }) | 
| 131 | -                        ->addColumn('action', function ($model) { | |
| 131 | +                        ->addColumn('action', function($model) { | |
| 132 | 132 |                              return '<a href='.url('templates/'.$model->id.'/edit'). | 
| 133 | 133 | " class='btn btn-sm btn-primary btn-xs'><i class='fa fa-edit' | 
| 134 | 134 | style='color:white;'> </i>  Edit</a>"; | 
| @@ -278,7 +278,7 @@ discard block | ||
| 278 | 278 | |
| 279 | 279 | $settings = \App\Model\Common\Setting::find(1); | 
| 280 | 280 | $fromname = $settings->company; | 
| 281 | -            \Mail::send('emails.mail', ['data' => $data], function ($m) use ($from, $to, $subject, $fromname, $toname, $cc, $attach) { | |
| 281 | +            \Mail::send('emails.mail', ['data' => $data], function($m) use ($from, $to, $subject, $fromname, $toname, $cc, $attach) { | |
| 282 | 282 | $m->from($from, $fromname); | 
| 283 | 283 | |
| 284 | 284 | $m->to($to, $toname)->subject($subject); | 
| @@ -378,7 +378,7 @@ discard block | ||
| 378 | 378 |                      $prices[] = $value->planPrice()->where('currency', $currencyAndSymbol['currency'])->min('add_price'); | 
| 379 | 379 | } | 
| 380 | 380 | $price = min($prices); | 
| 381 | - $format = currency_format($price,$code=$currencyAndSymbol['currency']); | |
| 381 | + $format = currency_format($price, $code = $currencyAndSymbol['currency']); | |
| 382 | 382 | $finalPrice = str_replace($currencyAndSymbol['symbol'], '', $format); | 
| 383 | 383 | $cost = '<span class="price-unit">'.$currencyAndSymbol['symbol'].'</span>'.$finalPrice; | 
| 384 | 384 | } | 
| @@ -79,19 +79,19 @@ discard block | ||
| 79 | 79 |                      ->select('number', 'created_at', 'grand_total', 'id', 'status'); | 
| 80 | 80 | |
| 81 | 81 | return \DataTables::of($invoices->get()) | 
| 82 | -                            ->addColumn('number', function ($model) { | |
| 82 | +                            ->addColumn('number', function($model) { | |
| 83 | 83 | return $model->number; | 
| 84 | 84 | }) | 
| 85 | -                            ->addColumn('date', function ($model) { | |
| 85 | +                            ->addColumn('date', function($model) { | |
| 86 | 86 | $date = $model->created_at; | 
| 87 | 87 | |
| 88 | 88 | return $date; | 
| 89 | 89 | }) | 
| 90 | -                            ->addColumn('total', function ($model) { | |
| 90 | +                            ->addColumn('total', function($model) { | |
| 91 | 91 | |
| 92 | - return currency_format($model->grand_total,$code =\Auth::user()->currency); | |
| 92 | + return currency_format($model->grand_total, $code = \Auth::user()->currency); | |
| 93 | 93 | }) | 
| 94 | -                            ->addColumn('Action', function ($model) { | |
| 94 | +                            ->addColumn('Action', function($model) { | |
| 95 | 95 | $status = $model->status; | 
| 96 | 96 | $payment = ''; | 
| 97 | 97 |                                  if ($status == 'Pending' && $model->grand_total > 0) { | 
| @@ -156,19 +156,19 @@ discard block | ||
| 156 | 156 | } | 
| 157 | 157 | |
| 158 | 158 | return \DataTables::of($versions) | 
| 159 | -                            ->addColumn('id', function ($versions) { | |
| 159 | +                            ->addColumn('id', function($versions) { | |
| 160 | 160 | return ucfirst($versions->id); | 
| 161 | 161 | }) | 
| 162 | -                            ->addColumn('version', function ($versions) { | |
| 162 | +                            ->addColumn('version', function($versions) { | |
| 163 | 163 | return ucfirst($versions->version); | 
| 164 | 164 | }) | 
| 165 | -                            ->addColumn('title', function ($versions) { | |
| 165 | +                            ->addColumn('title', function($versions) { | |
| 166 | 166 | return ucfirst($versions->title); | 
| 167 | 167 | }) | 
| 168 | -                            ->addColumn('description', function ($versions) { | |
| 168 | +                            ->addColumn('description', function($versions) { | |
| 169 | 169 | return ucfirst($versions->description); | 
| 170 | 170 | }) | 
| 171 | -                            ->addColumn('file', function ($versions) use ($countExpiry, $countVersions, $clientid, $invoiceid, $productid) { | |
| 171 | +                            ->addColumn('file', function($versions) use ($countExpiry, $countVersions, $clientid, $invoiceid, $productid) { | |
| 172 | 172 |                                  $invoice_id = Invoice::where('number', $invoiceid)->pluck('id')->first(); | 
| 173 | 173 |                                  $order = Order::where('invoice_id', '=', $invoice_id)->first(); | 
| 174 | 174 | $order_id = $order->id; | 
| @@ -234,18 +234,18 @@ discard block | ||
| 234 | 234 | } | 
| 235 | 235 | |
| 236 | 236 | return \DataTables::of($link) | 
| 237 | -                            ->addColumn('version', function ($link) { | |
| 237 | +                            ->addColumn('version', function($link) { | |
| 238 | 238 | return ucfirst($link['tag_name']); | 
| 239 | 239 | }) | 
| 240 | -                            ->addColumn('name', function ($link) { | |
| 240 | +                            ->addColumn('name', function($link) { | |
| 241 | 241 | return ucfirst($link['name']); | 
| 242 | 242 | }) | 
| 243 | -                            ->addColumn('description', function ($link) { | |
| 243 | +                            ->addColumn('description', function($link) { | |
| 244 | 244 | $markdown = Markdown::convertToHtml(ucfirst($link['body'])); | 
| 245 | 245 | |
| 246 | 246 | return $markdown; | 
| 247 | 247 | }) | 
| 248 | -                            ->addColumn('file', function ($link) use ($countExpiry, $countVersions, $invoiceid, $productid) { | |
| 248 | +                            ->addColumn('file', function($link) use ($countExpiry, $countVersions, $invoiceid, $productid) { | |
| 249 | 249 |                                  $order = Order::where('invoice_id', '=', $invoiceid)->first(); | 
| 250 | 250 | $order_id = $order->id; | 
| 251 | 251 |                                  $orderEndDate = Subscription::select('update_ends_at') | 
| @@ -281,20 +281,20 @@ discard block | ||
| 281 | 281 |              $orders = Order::where('client', \Auth::user()->id); | 
| 282 | 282 | |
| 283 | 283 | return \DataTables::of($orders->get()) | 
| 284 | -                            ->addColumn('id', function ($model) { | |
| 284 | +                            ->addColumn('id', function($model) { | |
| 285 | 285 | return $model->id; | 
| 286 | 286 | }) | 
| 287 | -                            ->addColumn('product_name', function ($model) { | |
| 287 | +                            ->addColumn('product_name', function($model) { | |
| 288 | 288 | return $model->product()->first()->name; | 
| 289 | 289 | }) | 
| 290 | -                            ->addColumn('expiry', function ($model) { | |
| 290 | +                            ->addColumn('expiry', function($model) { | |
| 291 | 291 | $tz = \Auth::user()->timezone()->first()->name; | 
| 292 | 292 | $end = $this->getExpiryDate($model); | 
| 293 | 293 | |
| 294 | 294 | return $end; | 
| 295 | 295 | }) | 
| 296 | 296 | |
| 297 | -                            ->addColumn('Action', function ($model) { | |
| 297 | +                            ->addColumn('Action', function($model) { | |
| 298 | 298 | $sub = $model->subscription()->first(); | 
| 299 | 299 |                                  $order = Order::where('id', $model->id)->select('product')->first(); | 
| 300 | 300 | $productid = $order->product; | 
| @@ -400,27 +400,27 @@ discard block | ||
| 400 | 400 |                      ->select('id', 'invoice_id', 'user_id', 'amount', 'payment_method', 'payment_status', 'created_at'); | 
| 401 | 401 | |
| 402 | 402 | return \DataTables::of($payments->get()) | 
| 403 | -                            ->addColumn('checkbox', function ($model) { | |
| 403 | +                            ->addColumn('checkbox', function($model) { | |
| 404 | 404 |                                  if (\Input::get('client') != 'true') { | 
| 405 | 405 | return "<input type='checkbox' class='payment_checkbox' | 
| 406 | 406 | value=".$model->id.' name=select[] id=check>'; | 
| 407 | 407 | } | 
| 408 | 408 | }) | 
| 409 | -                            ->addColumn('number', function ($model) { | |
| 409 | +                            ->addColumn('number', function($model) { | |
| 410 | 410 | return $model->invoice()->first()->number; | 
| 411 | 411 | }) | 
| 412 | -                            ->addColumn('amount', function ($model) { | |
| 412 | +                            ->addColumn('amount', function($model) { | |
| 413 | 413 | $currency = $model->invoice()->first()->currency; | 
| 414 | - $total = currency_format($model->amount,$code =$currency); | |
| 414 | + $total = currency_format($model->amount, $code = $currency); | |
| 415 | 415 | return $total; | 
| 416 | 416 | }) | 
| 417 | -                            ->addColumn('payment_method', function ($model) { | |
| 417 | +                            ->addColumn('payment_method', function($model) { | |
| 418 | 418 | return $model->payment_method; | 
| 419 | 419 | }) | 
| 420 | -                             ->addColumn('payment_status', function ($model) { | |
| 420 | +                             ->addColumn('payment_status', function($model) { | |
| 421 | 421 | return $model->payment_status; | 
| 422 | 422 | }) | 
| 423 | -                            ->addColumn('created_at', function ($model) { | |
| 423 | +                            ->addColumn('created_at', function($model) { | |
| 424 | 424 | $date1 = new DateTime($model->created_at); | 
| 425 | 425 | $tz = \Auth::user()->timezone()->first()->name; | 
| 426 | 426 | $date1->setTimezone(new DateTimeZone($tz)); | 
| @@ -451,13 +451,13 @@ discard block | ||
| 451 | 451 |                      ->select('id', 'invoice_id', 'user_id', 'payment_method', 'payment_status', 'created_at', 'amount'); | 
| 452 | 452 | //dd(\Input::all()); | 
| 453 | 453 | return \DataTables::of($payments->get()) | 
| 454 | -                            ->addColumn('number', function ($model) { | |
| 454 | +                            ->addColumn('number', function($model) { | |
| 455 | 455 | return $model->invoice()->first()->number; | 
| 456 | 456 | }) | 
| 457 | -                              ->addColumn('total', function ($model) { | |
| 457 | +                              ->addColumn('total', function($model) { | |
| 458 | 458 | return $model->amount; | 
| 459 | 459 | }) | 
| 460 | -                               ->addColumn('created_at', function ($model) { | |
| 460 | +                               ->addColumn('created_at', function($model) { | |
| 461 | 461 | $date1 = new DateTime($model->created_at); | 
| 462 | 462 | $tz = \Auth::user()->timezone()->first()->name; | 
| 463 | 463 | $date1->setTimezone(new DateTimeZone($tz)); | 
| @@ -193,34 +193,34 @@ | ||
| 193 | 193 |              $relation = $order->invoiceRelation()->pluck('invoice_id')->toArray(); | 
| 194 | 194 | $invoice = new Invoice(); | 
| 195 | 195 | $invoices = $invoice | 
| 196 | -                    ->select('number', 'created_at', 'grand_total','currency', 'id', 'status') | |
| 196 | +                    ->select('number', 'created_at', 'grand_total', 'currency', 'id', 'status') | |
| 197 | 197 |                      ->whereIn('id', $relation); | 
| 198 | 198 |              if ($invoices->get()->count() == 0) { | 
| 199 | 199 | $invoices = $order->invoice() | 
| 200 | 200 |                          ->select('number', 'created_at', 'grand_total', 'id', 'status'); | 
| 201 | 201 | } | 
| 202 | 202 | return \DataTables::of($invoices->get()) | 
| 203 | -             ->addColumn('number', function ($model) { | |
| 203 | +             ->addColumn('number', function($model) { | |
| 204 | 204 | return $model->number; | 
| 205 | 205 | }) | 
| 206 | -            ->addColumn('products', function ($model) { | |
| 206 | +            ->addColumn('products', function($model) { | |
| 207 | 207 | $invoice = $this->invoice->find($model->id); | 
| 208 | 208 |                  $products = $invoice->invoiceItem()->pluck('product_name')->toArray(); | 
| 209 | 209 | |
| 210 | 210 |                  return ucfirst(implode(',', $products)); | 
| 211 | 211 | }) | 
| 212 | -            ->addColumn('date', function ($model) { | |
| 212 | +            ->addColumn('date', function($model) { | |
| 213 | 213 | $date = date_create($model->created_at); | 
| 214 | 214 | |
| 215 | 215 | return date_format($date, 'M j, Y, g:i a'); | 
| 216 | 216 | }) | 
| 217 | -            ->addColumn('total', function ($model) { | |
| 218 | - return currency_format($model->grand_total,$code =$model->currency); | |
| 217 | +            ->addColumn('total', function($model) { | |
| 218 | + return currency_format($model->grand_total, $code = $model->currency); | |
| 219 | 219 | }) | 
| 220 | -            ->addColumn('status', function ($model) { | |
| 220 | +            ->addColumn('status', function($model) { | |
| 221 | 221 | return ucfirst($model->status); | 
| 222 | 222 | }) | 
| 223 | -            ->addColumn('action', function ($model) { | |
| 223 | +            ->addColumn('action', function($model) { | |
| 224 | 224 |                  if (\Auth::user()->role == 'admin') { | 
| 225 | 225 | $url = '/invoices/show?invoiceid='.$model->id; | 
| 226 | 226 |                  } else { | 
| @@ -49,17 +49,17 @@ discard block | ||
| 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 | ||
| 71 | 71 | }) | 
| 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>  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 | ||
| 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()); | 
| @@ -108,7 +108,7 @@ discard block | ||
| 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 | ||
| 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 | ||
| 175 | 175 | style='color:white;'> </i>  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 | }) | 
| @@ -359,11 +359,11 @@ discard block | ||
| 359 | 359 | |
| 360 | 360 | public function invoiceGenerateByForm(Request $request, $user_id = '') | 
| 361 | 361 |      { | 
| 362 | - $this->validate($request,[ | |
| 362 | + $this->validate($request, [ | |
| 363 | 363 | |
| 364 | 364 | 'plan' => 'required_if:subscription,true', | 
| 365 | 365 | 'price' => 'required', | 
| 366 | - ],[ | |
| 366 | + ], [ | |
| 367 | 367 | 'plan.required_if' =>'Select a Plan', | 
| 368 | 368 | ]); | 
| 369 | 369 |          try { |