|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Http\Controllers\OpenPayroll; |
|
4
|
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
|
|
|
|
|
|
6
|
|
|
use Illuminate\Http\Request; |
|
7
|
|
|
|
|
8
|
|
|
class PayrollController 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
|
|
|
$payrolls = \App\Models\OpenPayroll\Payroll::latest()->paginate(); |
|
23
|
|
|
|
|
24
|
|
|
return view('open-payroll.payroll.index', compact('payrolls')); |
|
|
|
|
|
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Show the form for creating a new resource. |
|
29
|
|
|
* |
|
30
|
|
|
* @return \Illuminate\Http\Response |
|
31
|
|
|
*/ |
|
32
|
|
|
public function create() |
|
33
|
|
|
{ |
|
34
|
|
|
return view('open-payroll.payroll.create'); |
|
|
|
|
|
|
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
|
|
|
'month' => 'required|min:1|max:12', |
|
48
|
|
|
'year' => 'required', |
|
49
|
|
|
'date' => 'required', |
|
50
|
|
|
]); |
|
51
|
|
|
|
|
52
|
|
|
$payroll = \App\Models\OpenPayroll\Payroll::create($request->only('user_id', 'month', 'year', 'date')); |
|
53
|
|
|
|
|
54
|
|
|
swal()->success('Payroll', 'You have successfully created a payroll.'); |
|
|
|
|
|
|
55
|
|
|
|
|
56
|
|
|
return redirect()->route('open-payroll.payroll.show', $payroll->hashslug); |
|
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Display the specified resource. |
|
61
|
|
|
* |
|
62
|
|
|
* @param int $id |
|
63
|
|
|
* |
|
64
|
|
|
* @return \Illuminate\Http\Response |
|
65
|
|
|
*/ |
|
66
|
|
|
public function show($id) |
|
67
|
|
|
{ |
|
68
|
|
|
$payroll = \App\Models\OpenPayroll\Payroll::with('payslips', 'payslips.user')->findByHashSlugOrId($id); |
|
69
|
|
|
|
|
70
|
|
|
return view('open-payroll.payroll.show', compact('payroll')); |
|
|
|
|
|
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Show the form for editing the specified resource. |
|
75
|
|
|
* |
|
76
|
|
|
* @param int $id |
|
77
|
|
|
* |
|
78
|
|
|
* @return \Illuminate\Http\Response |
|
79
|
|
|
*/ |
|
80
|
|
|
public function edit($id) |
|
81
|
|
|
{ |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Update the specified resource in storage. |
|
86
|
|
|
* |
|
87
|
|
|
* @param \Illuminate\Http\Request $request |
|
88
|
|
|
* @param int $id |
|
89
|
|
|
* |
|
90
|
|
|
* @return \Illuminate\Http\Response |
|
91
|
|
|
*/ |
|
92
|
|
|
public function update(Request $request, $id) |
|
93
|
|
|
{ |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Remove the specified resource from storage. |
|
98
|
|
|
* |
|
99
|
|
|
* @param int $id |
|
100
|
|
|
* |
|
101
|
|
|
* @return \Illuminate\Http\Response |
|
102
|
|
|
*/ |
|
103
|
|
|
public function destroy($id) |
|
104
|
|
|
{ |
|
105
|
|
|
$payroll = \App\Models\OpenPayroll\Payroll::whereHashslug($id)->firstOrFail(); |
|
106
|
|
|
|
|
107
|
|
|
if ($payroll->is_locked) { |
|
|
|
|
|
|
108
|
|
|
swal()->error('Payroll', 'You cannot delete locked payroll.'); |
|
|
|
|
|
|
109
|
|
|
|
|
110
|
|
|
return redirect()->route('open-payroll.payroll.index'); |
|
|
|
|
|
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
$payroll->delete(); |
|
114
|
|
|
swal()->success('Payroll', 'You have successfully delete a payroll'); |
|
115
|
|
|
|
|
116
|
|
|
return redirect()->route('open-payroll.payroll.index'); |
|
|
|
|
|
|
117
|
|
|
} |
|
118
|
|
|
} |
|
119
|
|
|
|
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