1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers\OpenPayroll\Setting; |
4
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
|
|
|
|
6
|
|
|
use App\Models\OpenPayroll\EarningType; |
7
|
|
|
use Illuminate\Http\Request; |
8
|
|
|
|
9
|
|
|
class EarningController extends Controller |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* Display a listing of the resource. |
13
|
|
|
* |
14
|
|
|
* @return \Illuminate\Http\Response |
15
|
|
|
*/ |
16
|
|
|
public function index() |
17
|
|
|
{ |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Show the form for creating a new resource. |
22
|
|
|
* |
23
|
|
|
* @return \Illuminate\Http\Response |
24
|
|
|
*/ |
25
|
|
|
public function create() |
26
|
|
|
{ |
27
|
|
|
return view('open-payroll.settings.earning.create'); |
|
|
|
|
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Store a newly created resource in storage. |
32
|
|
|
* |
33
|
|
|
* @param \Illuminate\Http\Request $request |
34
|
|
|
* |
35
|
|
|
* @return \Illuminate\Http\Response |
36
|
|
|
*/ |
37
|
|
|
public function store(Request $request) |
38
|
|
|
{ |
39
|
|
|
$this->validate($request, [ |
40
|
|
|
'name' => 'required|min:3|max:255', |
41
|
|
|
]); |
42
|
|
|
|
43
|
|
|
EarningType::create([ |
44
|
|
|
'name' => $request->name, |
45
|
|
|
'code' => kebab_case($request->name, ''), |
|
|
|
|
46
|
|
|
'is_locked' => false, |
47
|
|
|
]); |
48
|
|
|
|
49
|
|
|
swal()->success('Setting', 'You have successfully create a earning type.'); |
|
|
|
|
50
|
|
|
|
51
|
|
|
return redirect()->route('open-payroll.setting.index'); |
|
|
|
|
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Display the specified resource. |
56
|
|
|
* |
57
|
|
|
* @param int $id |
58
|
|
|
* |
59
|
|
|
* @return \Illuminate\Http\Response |
60
|
|
|
*/ |
61
|
|
|
public function show($id) |
62
|
|
|
{ |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Show the form for editing the specified resource. |
67
|
|
|
* |
68
|
|
|
* @param int $id |
69
|
|
|
* |
70
|
|
|
* @return \Illuminate\Http\Response |
71
|
|
|
*/ |
72
|
|
|
public function edit($id) |
73
|
|
|
{ |
74
|
|
|
$type = EarningType::findOrFail($id); |
75
|
|
|
|
76
|
|
|
return view('open-payroll.settings.earning.edit', compact('type')); |
|
|
|
|
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Update the specified resource in storage. |
81
|
|
|
* |
82
|
|
|
* @param \Illuminate\Http\Request $request |
83
|
|
|
* @param int $id |
84
|
|
|
* |
85
|
|
|
* @return \Illuminate\Http\Response |
86
|
|
|
*/ |
87
|
|
|
public function update(Request $request, $id) |
88
|
|
|
{ |
89
|
|
|
$this->validate($request, [ |
90
|
|
|
'name' => 'required|min:3|max:255', |
91
|
|
|
]); |
92
|
|
|
|
93
|
|
|
EarningType::whereId($id)->update([ |
94
|
|
|
'name' => $request->name, |
95
|
|
|
'code' => kebab_case($request->name, ''), |
|
|
|
|
96
|
|
|
'is_locked' => false, |
97
|
|
|
]); |
98
|
|
|
|
99
|
|
|
swal()->success('Setting', 'You have successfully update a earning type.'); |
|
|
|
|
100
|
|
|
|
101
|
|
|
return redirect()->route('open-payroll.setting.index'); |
|
|
|
|
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Remove the specified resource from storage. |
106
|
|
|
* |
107
|
|
|
* @param int $id |
108
|
|
|
* |
109
|
|
|
* @return \Illuminate\Http\Response |
110
|
|
|
*/ |
111
|
|
|
public function destroy($id) |
112
|
|
|
{ |
113
|
|
|
EarningType::whereId($id)->delete(); |
114
|
|
|
|
115
|
|
|
swal()->success('Setting', 'You have successfully delete a earning type.'); |
|
|
|
|
116
|
|
|
|
117
|
|
|
return redirect()->route('open-payroll.setting.index'); |
|
|
|
|
118
|
|
|
} |
119
|
|
|
} |
120
|
|
|
|
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