@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'providers' => [ |
|
| 4 | + 'providers' => [ |
|
| 5 | 5 | 0 => 'App\\Plugins\\Ccavanue\\ServiceProvider', |
| 6 | 6 | 1 => 'App\\Plugins\\Ping\\ServiceProvider', |
| 7 | 7 | 2 => 'App\\Plugins\\Twilio\\ServiceProvider', |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | 29 => 'App\\Providers\\EventServiceProvider', |
| 35 | 35 | 30 => 'App\\Providers\\RouteServiceProvider', |
| 36 | 36 | 31 => 'Illuminate\\Broadcasting\\BroadcastServiceProvider', |
| 37 | - ], |
|
| 38 | - 'eager' => [ |
|
| 37 | + ], |
|
| 38 | + 'eager' => [ |
|
| 39 | 39 | 0 => 'App\\Plugins\\Ccavanue\\ServiceProvider', |
| 40 | 40 | 1 => 'App\\Plugins\\Ping\\ServiceProvider', |
| 41 | 41 | 2 => 'App\\Plugins\\Twilio\\ServiceProvider', |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | 15 => 'App\\Providers\\AppServiceProvider', |
| 55 | 55 | 16 => 'App\\Providers\\EventServiceProvider', |
| 56 | 56 | 17 => 'App\\Providers\\RouteServiceProvider', |
| 57 | - ], |
|
| 58 | - 'deferred' => [ |
|
| 57 | + ], |
|
| 58 | + 'deferred' => [ |
|
| 59 | 59 | 'Illuminate\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider', |
| 60 | 60 | 'Illuminate\\Contracts\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider', |
| 61 | 61 | 'Illuminate\\Contracts\\Bus\\QueueingDispatcher' => 'Illuminate\\Bus\\BusServiceProvider', |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | 'Illuminate\\Broadcasting\\BroadcastManager' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider', |
| 123 | 123 | 'Illuminate\\Contracts\\Broadcasting\\Factory' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider', |
| 124 | 124 | 'Illuminate\\Contracts\\Broadcasting\\Broadcaster' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider', |
| 125 | - ], |
|
| 126 | - 'when' => [ |
|
| 125 | + ], |
|
| 126 | + 'when' => [ |
|
| 127 | 127 | 'Illuminate\\Bus\\BusServiceProvider' => [ |
| 128 | 128 | ], |
| 129 | 129 | 'Illuminate\\Cache\\CacheServiceProvider' => [ |
@@ -152,5 +152,5 @@ discard block |
||
| 152 | 152 | ], |
| 153 | 153 | 'Illuminate\\Broadcasting\\BroadcastServiceProvider' => [ |
| 154 | 154 | ], |
| 155 | - ], |
|
| 155 | + ], |
|
| 156 | 156 | ]; |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | // try { |
| 85 | 85 | return \Datatable::collection($this->product->select('id', 'name', 'type', 'group')->where('id', '!=', 1)->get()) |
| 86 | - ->addColumn('#', function ($model) { |
|
| 86 | + ->addColumn('#', function($model) { |
|
| 87 | 87 | return "<input type='checkbox' value=".$model->id.' name=select[] id=check>'; |
| 88 | 88 | }) |
| 89 | - ->addColumn('name', function ($model) { |
|
| 89 | + ->addColumn('name', function($model) { |
|
| 90 | 90 | return ucfirst($model->name); |
| 91 | 91 | }) |
| 92 | - ->addColumn('type', function ($model) { |
|
| 92 | + ->addColumn('type', function($model) { |
|
| 93 | 93 | //dd($model->type()); |
| 94 | 94 | if ($this->type->where('id', $model->type)->first()) { |
| 95 | 95 | return $this->type->where('id', $model->type)->first()->name; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | return 'Not available'; |
| 98 | 98 | } |
| 99 | 99 | }) |
| 100 | - ->addColumn('group', function ($model) { |
|
| 100 | + ->addColumn('group', function($model) { |
|
| 101 | 101 | //dd($model->type()); |
| 102 | 102 | if ($this->group->where('id', $model->group)->first()) { |
| 103 | 103 | return $this->group->where('id', $model->group)->first()->name; |
@@ -105,21 +105,21 @@ discard block |
||
| 105 | 105 | return 'Not available'; |
| 106 | 106 | } |
| 107 | 107 | }) |
| 108 | - ->addColumn('price', function ($model) { |
|
| 108 | + ->addColumn('price', function($model) { |
|
| 109 | 109 | if ($this->price->where('product_id', $model->id)->first()) { |
| 110 | 110 | return $this->price->where('product_id', $model->id)->first()->price; |
| 111 | 111 | } else { |
| 112 | 112 | return 'Not available'; |
| 113 | 113 | } |
| 114 | 114 | }) |
| 115 | - ->addColumn('currency', function ($model) { |
|
| 115 | + ->addColumn('currency', function($model) { |
|
| 116 | 116 | if ($this->price->where('product_id', $model->id)->first()) { |
| 117 | 117 | return $this->price->where('product_id', $model->id)->first()->currency; |
| 118 | 118 | } else { |
| 119 | 119 | return 'Not available'; |
| 120 | 120 | } |
| 121 | 121 | }) |
| 122 | - ->addColumn('action', function ($model) { |
|
| 122 | + ->addColumn('action', function($model) { |
|
| 123 | 123 | return '<a href='.url('products/'.$model->id.'/edit')." class='btn btn-sm btn-primary'>Edit</a>"; |
| 124 | 124 | }) |
| 125 | 125 | ->searchColumns('name', 'email') |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | 'currency.*' => 'required', |
| 175 | 175 | 'price.*' => 'required', |
| 176 | 176 | ]); |
| 177 | - $v->sometimes(['file', 'image', 'version'], 'required', function ($input) { |
|
| 177 | + $v->sometimes(['file', 'image', 'version'], 'required', function($input) { |
|
| 178 | 178 | return $input->type == 2 && $input->github_owner == '' && $input->github_repository == ''; |
| 179 | 179 | }); |
| 180 | 180 | |
| 181 | - $v->sometimes(['github_owner', 'github_repository'], 'required', function ($input) { |
|
| 181 | + $v->sometimes(['github_owner', 'github_repository'], 'required', function($input) { |
|
| 182 | 182 | return $input->type == 2 && $input->file == '' && $input->image == ''; |
| 183 | 183 | }); |
| 184 | 184 | if ($v->fails()) { |
@@ -299,11 +299,11 @@ discard block |
||
| 299 | 299 | 'currency.*' => 'required', |
| 300 | 300 | 'price.*' => 'required', |
| 301 | 301 | ]); |
| 302 | - $v->sometimes(['file', 'image', 'version'], 'required', function ($input) { |
|
| 302 | + $v->sometimes(['file', 'image', 'version'], 'required', function($input) { |
|
| 303 | 303 | return $input->type == 2 && $input->github_owner == '' && $input->github_repository == ''; |
| 304 | 304 | }); |
| 305 | 305 | |
| 306 | - $v->sometimes(['github_owner', 'github_repository'], 'required', function ($input) { |
|
| 306 | + $v->sometimes(['github_owner', 'github_repository'], 'required', function($input) { |
|
| 307 | 307 | return $input->type == 2 && $input->file == '' && $input->image == ''; |
| 308 | 308 | }); |
| 309 | 309 | if ($v->fails()) { |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | //dd($this->invoice->get()); |
| 92 | 92 | //$invoice = \DB::table('invoices'); |
| 93 | 93 | return \Datatable::query($this->invoice->select('id', 'user_id', 'number', 'date', 'grand_total', 'status', 'created_at')) |
| 94 | - ->addColumn('#', function ($model) { |
|
| 94 | + ->addColumn('#', function($model) { |
|
| 95 | 95 | return "<input type='checkbox' value=".$model->id.' name=select[] id=check>'; |
| 96 | 96 | }) |
| 97 | - ->addColumn('user_id', function ($model) { |
|
| 97 | + ->addColumn('user_id', function($model) { |
|
| 98 | 98 | |
| 99 | 99 | $first = $this->user->where('id', $model->user_id)->first()->first_name; |
| 100 | 100 | $last = $this->user->where('id', $model->user_id)->first()->last_name; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>'; |
| 104 | 104 | }) |
| 105 | 105 | ->showColumns('number', 'created_at', 'grand_total', 'status') |
| 106 | - ->addColumn('action', function ($model) { |
|
| 106 | + ->addColumn('action', function($model) { |
|
| 107 | 107 | $order = \App\Model\Order\Order::where('invoice_id', $model->id)->first(); |
| 108 | 108 | if (!$order) { |
| 109 | 109 | $action = '<a href='.url('order/execute?invoiceid='.$model->id)." class='btn btn-sm btn-primary'>Execute Order</a>"; |
@@ -379,6 +379,9 @@ discard block |
||
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | + /** |
|
| 383 | + * @param string $currency |
|
| 384 | + */ |
|
| 382 | 385 | public function createInvoiceItemsByAdmin($invoiceid, $productid, $code, $price, $currency, $qty) |
| 383 | 386 | { |
| 384 | 387 | try { |
@@ -634,6 +637,9 @@ discard block |
||
| 634 | 637 | } |
| 635 | 638 | } |
| 636 | 639 | |
| 640 | + /** |
|
| 641 | + * @param string $rate |
|
| 642 | + */ |
|
| 637 | 643 | public function calculateTotal($rate, $total) |
| 638 | 644 | { |
| 639 | 645 | try { |
@@ -659,7 +665,6 @@ discard block |
||
| 659 | 665 | /** |
| 660 | 666 | * Remove the specified resource from storage. |
| 661 | 667 | * |
| 662 | - * @param int $id |
|
| 663 | 668 | * |
| 664 | 669 | * @return Response |
| 665 | 670 | */ |
@@ -56,14 +56,14 @@ discard block |
||
| 56 | 56 | ->select('number', 'created_at', 'grand_total', 'id'); |
| 57 | 57 | |
| 58 | 58 | return \Datatable::query($invoices) |
| 59 | - ->addColumn('number', function ($model) { |
|
| 59 | + ->addColumn('number', function($model) { |
|
| 60 | 60 | return $model->number; |
| 61 | 61 | }) |
| 62 | 62 | ->showColumns('created_at') |
| 63 | - ->addColumn('total', function ($model) { |
|
| 63 | + ->addColumn('total', function($model) { |
|
| 64 | 64 | return $model->grand_total; |
| 65 | 65 | }) |
| 66 | - ->addColumn('action', function ($model) { |
|
| 66 | + ->addColumn('action', function($model) { |
|
| 67 | 67 | return '<a href='.url('my-invoice/'.$model->id)." class='btn btn-sm btn-primary'>View</a>"; |
| 68 | 68 | }) |
| 69 | 69 | ->searchColumns('number', 'created_at', 'total') |
@@ -91,15 +91,15 @@ discard block |
||
| 91 | 91 | //->select('id','product','created_at') |
| 92 | 92 | |
| 93 | 93 | return \Datatable::query($orders) |
| 94 | - ->addColumn('id', function ($model) { |
|
| 94 | + ->addColumn('id', function($model) { |
|
| 95 | 95 | return $model->id; |
| 96 | 96 | }) |
| 97 | 97 | |
| 98 | - ->addColumn('product', function ($model) { |
|
| 98 | + ->addColumn('product', function($model) { |
|
| 99 | 99 | return $model->product()->first()->name; |
| 100 | 100 | }) |
| 101 | 101 | ->showColumns('created_at') |
| 102 | - ->addColumn('ends_at', function ($model) { |
|
| 102 | + ->addColumn('ends_at', function($model) { |
|
| 103 | 103 | $end = $model->subscription()->first()->ends_at; |
| 104 | 104 | if ($end == '0000-00-00 00:00:00' || $end == null) { |
| 105 | 105 | $end = '--'; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | return $end; |
| 109 | 109 | }) |
| 110 | - ->addColumn('action', function ($model) { |
|
| 110 | + ->addColumn('action', function($model) { |
|
| 111 | 111 | //dd($model); |
| 112 | 112 | return '<a href='.url('my-order/'.$model->id)." class='btn btn-sm btn-primary'>Details</a>" |
| 113 | 113 | .' <a href='.url('my-invoice/'.$model->invoice()->first()->id)." class='btn btn-sm btn-primary'>Invoice</a>" |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | $subscriptions = $this->subscription->where('user_id', \Auth::user()->id)->get(); |
| 137 | 137 | |
| 138 | 138 | return \Datatable::collection($subscriptions) |
| 139 | - ->addColumn('id', function ($model) { |
|
| 139 | + ->addColumn('id', function($model) { |
|
| 140 | 140 | return $model->id; |
| 141 | 141 | }) |
| 142 | 142 | ->showColumns('created_at') |
| 143 | 143 | |
| 144 | - ->addColumn('ends_at', function ($model) { |
|
| 144 | + ->addColumn('ends_at', function($model) { |
|
| 145 | 145 | return $model->subscription()->first()->ends_at; |
| 146 | 146 | }) |
| 147 | 147 | ->searchColumns('id', 'created_at', 'ends_at') |
@@ -255,19 +255,19 @@ discard block |
||
| 255 | 255 | ->select('number', 'created_at', 'grand_total', 'id'); |
| 256 | 256 | |
| 257 | 257 | return \Datatable::query($invoices) |
| 258 | - ->addColumn('number', function ($model) { |
|
| 258 | + ->addColumn('number', function($model) { |
|
| 259 | 259 | return $model->number; |
| 260 | 260 | }) |
| 261 | - ->addColumn('invoice_item', function ($model) { |
|
| 261 | + ->addColumn('invoice_item', function($model) { |
|
| 262 | 262 | $products = $model->invoiceItem()->lists('product_name')->toArray(); |
| 263 | 263 | |
| 264 | 264 | return ucfirst(implode(',', $products)); |
| 265 | 265 | }) |
| 266 | 266 | ->showColumns('created_at') |
| 267 | - ->addColumn('total', function ($model) { |
|
| 267 | + ->addColumn('total', function($model) { |
|
| 268 | 268 | return $model->grand_total; |
| 269 | 269 | }) |
| 270 | - ->addColumn('action', function ($model) { |
|
| 270 | + ->addColumn('action', function($model) { |
|
| 271 | 271 | if (\Auth::user()->role == 'admin') { |
| 272 | 272 | $url = '/invoices/show?invoiceid='.$model->id; |
| 273 | 273 | } else { |
@@ -294,11 +294,11 @@ discard block |
||
| 294 | 294 | ->select('id', 'invoice_id', 'user_id', 'amount', 'payment_method', 'payment_status', 'created_at'); |
| 295 | 295 | |
| 296 | 296 | return \Datatable::query($payments) |
| 297 | - ->addColumn('number', function ($model) { |
|
| 297 | + ->addColumn('number', function($model) { |
|
| 298 | 298 | return $model->invoice()->first()->number; |
| 299 | 299 | }) |
| 300 | 300 | ->showColumns('amount', 'payment_method', 'payment_status') |
| 301 | - ->addColumn('total', function ($model) { |
|
| 301 | + ->addColumn('total', function($model) { |
|
| 302 | 302 | return $model->grand_total; |
| 303 | 303 | }) |
| 304 | 304 | |