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 Input; |
|
|
|
|
18
|
|
|
use Excel; |
|
|
|
|
19
|
|
|
|
20
|
|
|
class SendingMethodCountryPriceController extends Controller |
21
|
|
|
{ |
22
|
|
|
public function index(Request $request, $sendingMethodId) |
23
|
|
|
{ |
24
|
|
|
if ($request->wantsJson()) { |
25
|
|
|
$users = SendingMethodService::getCountryModel()->where('sending_method_id', '=', $sendingMethodId); |
26
|
|
|
|
27
|
|
|
$datatables = \DataTables::of($users)->addColumn('action', function ($users) use ($sendingMethodId) { |
28
|
|
|
$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')); |
29
|
|
|
$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; |
30
|
|
|
|
31
|
|
|
return $link; |
32
|
|
|
}); |
33
|
|
|
|
34
|
|
|
return $datatables->make(true); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
return view('backend.sending_method_country_price.index')->with('sendingMethod', SendingMethodService::find($sendingMethodId)); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function create($sendingMethodId) |
41
|
|
|
{ |
42
|
|
|
return view('backend.sending_method_country_price.create')->with(array( |
43
|
|
|
'taxRates' => TaxRateService::selectAll()->pluck('rate', 'id'), |
44
|
|
|
'sendingMethod' => SendingMethodService::find($sendingMethodId) |
45
|
|
|
)); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function getImport($sendingMethodId) |
49
|
|
|
{ |
50
|
|
|
return view('backend.sending_method_country_price.import')->with(array( |
51
|
|
|
'taxRates' => TaxRateService::selectAll()->pluck('rate', 'id'), |
52
|
|
|
'sendingMethod' => SendingMethodService::find($sendingMethodId) |
53
|
|
|
)); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function postImport(Request $request, $sendingMethodId) |
57
|
|
|
{ |
58
|
|
|
$file = $request->file('file'); |
59
|
|
|
$countries = \Excel::load($file, function($reader) { |
|
|
|
|
60
|
|
|
})->get(); |
61
|
|
|
|
62
|
|
|
if($countries) { |
63
|
|
|
$result = SendingMethodService::importCountries($countries, $request->get('tax_rate_id'), $sendingMethodId); |
|
|
|
|
64
|
|
|
flash('The countries are inserted.'); |
65
|
|
|
return redirect()->route('sending-method.country-prices.index', $sendingMethodId); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function store(Request $request, $sendingMethodId) |
70
|
|
|
{ |
71
|
|
|
$result = SendingMethodService::createCountry($request->all(), $sendingMethodId); |
72
|
|
|
return SendingMethodService::notificationRedirect(array('sending-method.country-prices.index', $sendingMethodId), $result, 'The country was inserted.'); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function edit($sendingMethodId, $id) |
76
|
|
|
{ |
77
|
|
|
return view('backend.sending_method_country_price.edit')->with(array( |
78
|
|
|
'taxRates' => TaxRateService::selectAll()->pluck('rate', 'id'), |
79
|
|
|
'sendingMethod' => SendingMethodService::find($sendingMethodId), |
80
|
|
|
'sendingMethodCountry' => SendingMethodService::findCountry($id) |
81
|
|
|
)); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function update(Request $request, $sendingMethodId, $id) |
85
|
|
|
{ |
86
|
|
|
$result = SendingMethodService::updateCountryById($request->all(), $id); |
87
|
|
|
return SendingMethodService::notificationRedirect(array('sending-method.country-prices.index', $sendingMethodId), $result, 'The country was updated.'); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function destroy($sendingMethodId, $id) |
91
|
|
|
{ |
92
|
|
|
$result = SendingMethodService::destroyCountry($id); |
93
|
|
|
|
94
|
|
|
if ($result) { |
95
|
|
|
flash('The country price was deleted.'); |
96
|
|
|
return redirect()->route('sending-method.country-prices.index', $sendingMethodId); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
} |
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