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