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