|
1
|
|
|
<?php namespace App\Http\Controllers\Backend; |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* CouponController |
|
5
|
|
|
* |
|
6
|
|
|
* This is the controller of the sending methods of the shop |
|
7
|
|
|
* @author Matthijs Neijenhuijs <[email protected]> |
|
8
|
|
|
* @version 1.0 |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
use App\Http\Controllers\Controller; |
|
12
|
|
|
use Hideyo\Ecommerce\Framework\Services\SendingMethod\SendingMethodFacade as SendingMethodService; |
|
13
|
|
|
use Hideyo\Ecommerce\Framework\Services\PaymentMethod\PaymentMethodFacade as PaymentMethodService; |
|
14
|
|
|
use Hideyo\Ecommerce\Framework\Services\TaxRate\TaxRateFacade as TaxRateService; |
|
15
|
|
|
|
|
16
|
|
|
use Illuminate\Http\Request; |
|
17
|
|
|
use Notification; |
|
18
|
|
|
use Input; |
|
|
|
|
|
|
19
|
|
|
use Excel; |
|
|
|
|
|
|
20
|
|
|
|
|
21
|
|
|
class SendingMethodCountryPriceController extends Controller |
|
22
|
|
|
{ |
|
23
|
|
|
public function index($sendingMethodId) |
|
24
|
|
|
{ |
|
25
|
|
|
if ($request->wantsJson()) { |
|
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
$users = SendingMethodService::getCountryModel()->select([ |
|
28
|
|
|
|
|
29
|
|
|
'id', |
|
30
|
|
|
'name'] |
|
31
|
|
|
)->where('sending_method_id', '=', $sendingMethodId); |
|
32
|
|
|
|
|
33
|
|
|
$datatables = \Datatables::of($users)->addColumn('action', function ($users) use ($sendingMethodId) { |
|
|
|
|
|
|
34
|
|
|
$delete = \Form::deleteajax(url()->route('sending-method.country-prices.destroy', array('sendingMethodId' => $sendingMethodId, 'id' => $users->id)), 'Delete', '', array('class'=>'btn btn-default btn-sm btn-danger')); |
|
35
|
|
|
$link = '<a href="'.url()->route('sending-method.country-prices.edit', array('sendingMethodId' => $sendingMethodId, 'id' => $users->id)).'" class="btn btn-default btn-sm btn-success"><i class="entypo-pencil"></i>Edit</a> '.$delete; |
|
36
|
|
|
|
|
37
|
|
|
return $link; |
|
38
|
|
|
}); |
|
39
|
|
|
|
|
40
|
|
|
return $datatables->make(true); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
return view('backend.sending_method_country_price.index')->with('sendingMethod', SendingMethodService::find($sendingMethodId)); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function create($sendingMethodId) |
|
47
|
|
|
{ |
|
48
|
|
|
return view('backend.sending_method_country_price.create')->with(array( |
|
49
|
|
|
'taxRates' => TaxRateService::selectAll()->pluck('rate', 'id'), |
|
50
|
|
|
'sendingMethod' => SendingMethodService::find($sendingMethodId) |
|
51
|
|
|
)); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function getImport($sendingMethodId) |
|
55
|
|
|
{ |
|
56
|
|
|
return view('backend.sending_method_country_price.import')->with(array( |
|
57
|
|
|
'taxRates' => TaxRateService::selectAll()->pluck('rate', 'id'), |
|
58
|
|
|
'sendingMethod' => SendingMethodService::find($sendingMethodId) |
|
59
|
|
|
)); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function postImport(Request $request, $sendingMethodId) |
|
63
|
|
|
{ |
|
64
|
|
|
$file = $request->file('file'); |
|
65
|
|
|
$countries = \Excel::load($file, function($reader) { |
|
|
|
|
|
|
66
|
|
|
})->get(); |
|
67
|
|
|
|
|
68
|
|
|
if($countries) { |
|
69
|
|
|
$result = SendingMethodService::importCountries($countries, $request->get('tax_rate_id'), $sendingMethodId); |
|
|
|
|
|
|
70
|
|
|
Notification::success('The countries are inserted.'); |
|
71
|
|
|
return redirect()->route('sending-method.country-prices.index', $sendingMethodId); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function store(Request $request, $sendingMethodId) |
|
76
|
|
|
{ |
|
77
|
|
|
$result = SendingMethodService::createCountry($request->all(), $sendingMethodId); |
|
78
|
|
|
return SendingMethodService::notificationRedirect(array('sending-method.country-prices.index', $sendingMethodId), $result, 'The country was inserted.'); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
public function edit($sendingMethodId, $id) |
|
82
|
|
|
{ |
|
83
|
|
|
return view('backend.sending_method_country_price.edit')->with(array( |
|
84
|
|
|
'taxRates' => TaxRateService::selectAll()->pluck('rate', 'id'), |
|
85
|
|
|
'sendingMethod' => SendingMethodService::find($sendingMethodId), |
|
86
|
|
|
'sendingMethodCountry' => SendingMethodService::findCountry($id) |
|
87
|
|
|
)); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
public function update(Request $request, $sendingMethodId, $id) |
|
91
|
|
|
{ |
|
92
|
|
|
$result = SendingMethodService::updateCountryById($request->all(), $id); |
|
93
|
|
|
return SendingMethodService::notificationRedirect(array('sending-method.country-prices.index', $sendingMethodId), $result, 'The country was updated.'); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function destroy($sendingMethodId, $id) |
|
97
|
|
|
{ |
|
98
|
|
|
$result = SendingMethodService::destroyCountry($id); |
|
99
|
|
|
|
|
100
|
|
|
if ($result) { |
|
101
|
|
|
Notification::success('The country price was deleted.'); |
|
102
|
|
|
return redirect()->route('sending-method.country-prices.index', $sendingMethodId); |
|
103
|
|
|
} |
|
104
|
|
|
} |
|
105
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths