|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Http\Controllers\OpenPayroll; |
|
4
|
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
|
|
|
|
|
|
6
|
|
|
use Illuminate\Http\Request; |
|
7
|
|
|
|
|
8
|
|
|
class PayslipController extends Controller |
|
9
|
|
|
{ |
|
10
|
|
|
public function __construct() |
|
11
|
|
|
{ |
|
12
|
|
|
$this->middleware('auth'); |
|
13
|
|
|
} |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Display a listing of the resource. |
|
17
|
|
|
* |
|
18
|
|
|
* @return \Illuminate\Http\Response |
|
19
|
|
|
*/ |
|
20
|
|
|
public function index() |
|
21
|
|
|
{ |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Show the form for creating a new resource. |
|
26
|
|
|
* |
|
27
|
|
|
* @return \Illuminate\Http\Response |
|
28
|
|
|
*/ |
|
29
|
|
|
public function create() |
|
30
|
|
|
{ |
|
31
|
|
|
$employees = \App\Models\OpenPayroll\Employee::has('salary')->has('position')->with('salary', 'position')->get(); |
|
32
|
|
|
$payrolls = \App\Models\OpenPayroll\Payroll::whereIsLocked(false)->latest()->get(); |
|
33
|
|
|
|
|
34
|
|
|
return view('open-payroll.payslip.create', compact('employees', 'payrolls')); |
|
|
|
|
|
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Store a newly created resource in storage. |
|
39
|
|
|
* |
|
40
|
|
|
* @param \Illuminate\Http\Request $request |
|
41
|
|
|
* |
|
42
|
|
|
* @return \Illuminate\Http\Response |
|
43
|
|
|
*/ |
|
44
|
|
|
public function store(Request $request) |
|
45
|
|
|
{ |
|
46
|
|
|
$this->validate($request, [ |
|
47
|
|
|
'payroll' => 'required', |
|
48
|
|
|
'user_id' => 'required', |
|
49
|
|
|
'employees' => 'required', |
|
50
|
|
|
]); |
|
51
|
|
|
|
|
52
|
|
|
$payroll = \App\Models\OpenPayroll\Payroll::findByHashSlugOrId($request->payroll); |
|
53
|
|
|
|
|
54
|
|
|
$employees = $request->employees; |
|
55
|
|
|
foreach ($employees as $hashslug) { |
|
56
|
|
|
$employee = \App\Models\OpenPayroll\Employee::hashslug($hashslug)->has('salary')->with('salary')->firstOrFail(); |
|
57
|
|
|
$employee->payslips()->updateOrCreate([ |
|
58
|
|
|
'payroll_id' => $payroll->id, |
|
|
|
|
|
|
59
|
|
|
'basic_salary' => $employee->salary->amount, |
|
60
|
|
|
'gross_salary' => $employee->salary->amount, |
|
61
|
|
|
'net_salary' => $employee->salary->amount, |
|
62
|
|
|
'is_verified' => false, |
|
63
|
|
|
'is_approved' => false, |
|
64
|
|
|
'is_locked' => false, |
|
65
|
|
|
]); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
swal()->success('Payslip', 'You have successfully created payslip(s).'); |
|
|
|
|
|
|
69
|
|
|
|
|
70
|
|
|
return redirect()->route('open-payroll.payroll.show', $request->payroll); |
|
|
|
|
|
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Display the specified resource. |
|
75
|
|
|
* |
|
76
|
|
|
* @param int $id |
|
77
|
|
|
* |
|
78
|
|
|
* @return \Illuminate\Http\Response |
|
79
|
|
|
*/ |
|
80
|
|
|
public function show($id) |
|
81
|
|
|
{ |
|
82
|
|
|
$payslip = \App\Models\OpenPayroll\Payslip::whereHashslug($id)->with('payroll', 'earnings', 'earnings.type', 'deductions', 'deductions.type')->firstOrFail(); |
|
83
|
|
|
|
|
84
|
|
|
return view('open-payroll.payslip.show', compact('payslip')); |
|
|
|
|
|
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Show the form for editing the specified resource. |
|
89
|
|
|
* |
|
90
|
|
|
* @param int $id |
|
91
|
|
|
* |
|
92
|
|
|
* @return \Illuminate\Http\Response |
|
93
|
|
|
*/ |
|
94
|
|
|
public function edit($id) |
|
95
|
|
|
{ |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* Update the specified resource in storage. |
|
100
|
|
|
* |
|
101
|
|
|
* @param \Illuminate\Http\Request $request |
|
102
|
|
|
* @param int $id |
|
103
|
|
|
* |
|
104
|
|
|
* @return \Illuminate\Http\Response |
|
105
|
|
|
*/ |
|
106
|
|
|
public function update(Request $request, $id) |
|
107
|
|
|
{ |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* Remove the specified resource from storage. |
|
112
|
|
|
* |
|
113
|
|
|
* @param int $id |
|
114
|
|
|
* |
|
115
|
|
|
* @return \Illuminate\Http\Response |
|
116
|
|
|
*/ |
|
117
|
|
|
public function destroy($id) |
|
118
|
|
|
{ |
|
119
|
|
|
} |
|
120
|
|
|
} |
|
121
|
|
|
|
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