1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers; |
4
|
|
|
|
5
|
|
|
use Validator; |
6
|
|
|
use App\Continent; |
|
|
|
|
7
|
|
|
use Illuminate\Http\Request; |
8
|
|
|
|
9
|
|
|
class ContinentController extends Controller |
|
|
|
|
10
|
|
|
{ |
11
|
|
|
/* Restrict the access to this resource just to logged in users */ |
12
|
|
|
public function __construct() |
13
|
|
|
{ |
14
|
|
|
$this->middleware('admin'); |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Display a listing of the resource. |
19
|
|
|
* |
20
|
|
|
* @return \Illuminate\Http\Response |
21
|
|
|
*/ |
22
|
|
|
public function index() |
23
|
|
|
{ |
24
|
|
|
$continents = Continent::orderBy('name')->paginate(10); |
25
|
|
|
|
26
|
|
|
return view('continents.index', compact('continents')) |
27
|
|
|
->with('i', (request()->input('page', 1) - 1) * 10); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Show the form for creating a new resource. |
32
|
|
|
* |
33
|
|
|
* @return \Illuminate\Http\Response |
34
|
|
|
*/ |
35
|
|
|
public function create() |
36
|
|
|
{ |
37
|
|
|
return view('continents.create'); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Store a newly created resource in storage. |
42
|
|
|
* |
43
|
|
|
* @param \Illuminate\Http\Request $request |
44
|
|
|
* @return \Illuminate\Http\Response |
45
|
|
|
*/ |
46
|
|
|
public function store(Request $request) |
47
|
|
|
{ |
48
|
|
|
|
49
|
|
|
// Validate form datas |
50
|
|
|
$validator = Validator::make($request->all(), [ |
51
|
|
|
'name' => 'required', |
52
|
|
|
'code' => 'required', |
53
|
|
|
]); |
54
|
|
|
if ($validator->fails()) { |
55
|
|
|
return back()->withErrors($validator)->withInput(); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
$continent = new Continent(); |
59
|
|
|
$continent->name = $request->get('name'); |
60
|
|
|
$continent->code = $request->get('code'); |
61
|
|
|
|
62
|
|
|
$continent->save(); |
63
|
|
|
|
64
|
|
|
return redirect()->route('continents.index') |
65
|
|
|
->with('success', __('messages.continent_added_successfully')); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Display the specified resource. |
70
|
|
|
* |
71
|
|
|
* @param \App\Continent $continent |
72
|
|
|
* @return \Illuminate\Http\Response |
73
|
|
|
*/ |
74
|
|
|
public function show(Continent $continent) |
75
|
|
|
{ |
76
|
|
|
return view('continents.show', compact('continent')); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Show the form for editing the specified resource. |
81
|
|
|
* |
82
|
|
|
* @param \App\Continent $continent |
83
|
|
|
* @return \Illuminate\Http\Response |
84
|
|
|
*/ |
85
|
|
|
public function edit(Continent $continent) |
86
|
|
|
{ |
87
|
|
|
return view('continents.edit', compact('continent')); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Update the specified resource in storage. |
92
|
|
|
* |
93
|
|
|
* @param \Illuminate\Http\Request $request |
94
|
|
|
* @param \App\Continent $continent |
95
|
|
|
* @return \Illuminate\Http\Response |
96
|
|
|
*/ |
97
|
|
|
public function update(Request $request, Continent $continent) |
98
|
|
|
{ |
99
|
|
|
request()->validate([ |
100
|
|
|
'name' => 'required', |
101
|
|
|
'code' => 'required', |
102
|
|
|
]); |
103
|
|
|
|
104
|
|
|
$continent->update($request->all()); |
105
|
|
|
|
106
|
|
|
return redirect()->route('continents.index') |
107
|
|
|
->with('success', __('messages.continent_updated_successfully')); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Remove the specified resource from storage. |
112
|
|
|
* |
113
|
|
|
* @param \App\Continent $continent |
114
|
|
|
* @return \Illuminate\Http\Response |
115
|
|
|
*/ |
116
|
|
|
public function destroy(Continent $continent) |
117
|
|
|
{ |
118
|
|
|
$continent->delete(); |
119
|
|
|
|
120
|
|
|
return redirect()->route('continents.index') |
121
|
|
|
->with('success', __('messages.continent_deleted_successfully')); |
122
|
|
|
} |
123
|
|
|
} |
124
|
|
|
|
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