|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PWWEB\Localisation\Controllers; |
|
4
|
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
|
6
|
|
|
use Flash; |
|
|
|
|
|
|
7
|
|
|
use Illuminate\Http\Request; |
|
8
|
|
|
use PWWEB\Localisation\Repositories\CurrencyRepository; |
|
9
|
|
|
use PWWEB\Localisation\Requests\CreateCurrencyRequest; |
|
10
|
|
|
use PWWEB\Localisation\Requests\UpdateCurrencyRequest; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* PWWEB\Localisation\Controllers\CurrencyController CurrencyController. |
|
14
|
|
|
* |
|
15
|
|
|
* The CRUD controller for Currency |
|
16
|
|
|
* Class CurrencyController |
|
17
|
|
|
* |
|
18
|
|
|
* @package pwweb/localisation |
|
19
|
|
|
* @author Frank Pillukeit <[email protected]> |
|
20
|
|
|
* @author Richard Browne <[email protected] |
|
21
|
|
|
* @copyright 2020 pw-websolutions.com |
|
22
|
|
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License |
|
23
|
|
|
*/ |
|
24
|
|
|
class CurrencyController extends Controller |
|
25
|
|
|
{ |
|
26
|
|
|
/** @var CurrencyRepository */ |
|
27
|
|
|
private $currencyRepository; |
|
28
|
|
|
|
|
29
|
|
|
public function __construct(CurrencyRepository $currencyRepo) |
|
30
|
|
|
{ |
|
31
|
|
|
$this->currencyRepository = $currencyRepo; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Display a listing of the Currency. |
|
36
|
|
|
* |
|
37
|
|
|
* @param Request $request |
|
38
|
|
|
* |
|
39
|
|
|
* @return \Illuminate\View\View |
|
40
|
|
|
*/ |
|
41
|
|
|
public function index(Request $request) |
|
42
|
|
|
{ |
|
43
|
|
|
$currencies = $this->currencyRepository->all(); |
|
44
|
|
|
|
|
45
|
|
|
return view('localisation::currencies.index') |
|
46
|
|
|
->with('currencies', $currencies); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Show the form for creating a new Currency. |
|
51
|
|
|
* |
|
52
|
|
|
* @return \Illuminate\View\View |
|
53
|
|
|
*/ |
|
54
|
|
|
public function create() |
|
55
|
|
|
{ |
|
56
|
|
|
return view('localisation::currencies.create'); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Store a newly created Currency in storage. |
|
61
|
|
|
* |
|
62
|
|
|
* @param CreateCurrencyRequest $request |
|
63
|
|
|
* |
|
64
|
|
|
* @return \Illuminate\Http\RedirectResponse |
|
65
|
|
|
*/ |
|
66
|
|
|
public function store(CreateCurrencyRequest $request) |
|
67
|
|
|
{ |
|
68
|
|
|
$input = $request->all(); |
|
69
|
|
|
|
|
70
|
|
|
$currency = $this->currencyRepository->create($input); |
|
|
|
|
|
|
71
|
|
|
|
|
72
|
|
|
Flash::success('Currency saved successfully.'); |
|
73
|
|
|
|
|
74
|
|
|
return redirect(route('localisation.currencies.index')); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Display the specified Currency. |
|
79
|
|
|
* |
|
80
|
|
|
* @param int $id |
|
81
|
|
|
* |
|
82
|
|
|
* @return \Illuminate\View\View|\Illuminate\Http\RedirectResponse |
|
83
|
|
|
*/ |
|
84
|
|
|
public function show($id) |
|
85
|
|
|
{ |
|
86
|
|
|
$currency = $this->currencyRepository->find($id); |
|
87
|
|
|
|
|
88
|
|
|
if (empty($currency)) { |
|
89
|
|
|
Flash::error('Currency not found'); |
|
90
|
|
|
|
|
91
|
|
|
return redirect(route('localisation.currencies.index')); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
return view('localisation::currencies.show')->with('currency', $currency); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Show the form for editing the specified Currency. |
|
99
|
|
|
* |
|
100
|
|
|
* @param int $id |
|
101
|
|
|
* |
|
102
|
|
|
* @return \Illuminate\View\View|\Illuminate\Http\RedirectResponse |
|
103
|
|
|
*/ |
|
104
|
|
|
public function edit($id) |
|
105
|
|
|
{ |
|
106
|
|
|
$currency = $this->currencyRepository->find($id); |
|
107
|
|
|
|
|
108
|
|
|
if (empty($currency)) { |
|
109
|
|
|
Flash::error('Currency not found'); |
|
110
|
|
|
|
|
111
|
|
|
return redirect(route('localisation.currencies.index')); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
return view('localisation::currencies.edit')->with('currency', $currency); |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* Update the specified Currency in storage. |
|
119
|
|
|
* |
|
120
|
|
|
* @param int $id |
|
121
|
|
|
* @param UpdateCurrencyRequest $request |
|
122
|
|
|
* |
|
123
|
|
|
* @return \Illuminate\Http\RedirectResponse |
|
124
|
|
|
*/ |
|
125
|
|
|
public function update($id, UpdateCurrencyRequest $request) |
|
126
|
|
|
{ |
|
127
|
|
|
$currency = $this->currencyRepository->find($id); |
|
128
|
|
|
|
|
129
|
|
|
if (empty($currency)) { |
|
130
|
|
|
Flash::error('Currency not found'); |
|
131
|
|
|
|
|
132
|
|
|
return redirect(route('localisation.currencies.index')); |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
$currency = $this->currencyRepository->update($request->all(), $id); |
|
|
|
|
|
|
136
|
|
|
|
|
137
|
|
|
Flash::success('Currency updated successfully.'); |
|
138
|
|
|
|
|
139
|
|
|
return redirect(route('localisation.currencies.index')); |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* Remove the specified Currency from storage. |
|
144
|
|
|
* |
|
145
|
|
|
* @param int $id |
|
146
|
|
|
* |
|
147
|
|
|
* @throws \Exception |
|
148
|
|
|
* |
|
149
|
|
|
* @return \Illuminate\Http\RedirectResponse |
|
150
|
|
|
*/ |
|
151
|
|
|
public function destroy($id) |
|
152
|
|
|
{ |
|
153
|
|
|
$currency = $this->currencyRepository->find($id); |
|
154
|
|
|
|
|
155
|
|
|
if (empty($currency)) { |
|
156
|
|
|
Flash::error('Currency not found'); |
|
157
|
|
|
|
|
158
|
|
|
return redirect(route('localisation.currencies.index')); |
|
159
|
|
|
} |
|
160
|
|
|
|
|
161
|
|
|
$this->currencyRepository->delete($id); |
|
162
|
|
|
|
|
163
|
|
|
Flash::success('Currency deleted successfully.'); |
|
164
|
|
|
|
|
165
|
|
|
return redirect(route('localisation.currencies.index')); |
|
166
|
|
|
} |
|
167
|
|
|
} |
|
168
|
|
|
|
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