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