Commit 922e2fa6 authored by Achmad Hammam's avatar Achmad Hammam
Browse files

update

parent 8d62c6a2
......@@ -16,14 +16,19 @@
class GajiController extends Controller
{
function download()
function download(Request $request)
{
$validation = $request->validate([
'bulan' => 'required',
'tahun' => 'required'
]);
$authUser = auth('api')->user();
$gaji_pegawai = VwGajiPegawai::with([
'bonus_gaji_pegawai' => function ($q) {
$q->orderBy('id', 'desc');
}
])->with([
$gaji_pegawai = VwGajiPegawai::where('user_id', '=', $authUser->id)
->with([
'bonus_gaji_pegawai' => function ($q) {
$q->orderBy('id', 'desc');
}
])->with([
'potongan_gaji_pegawai' => function ($q) {
$q->orderBy('id', 'desc');
}
......@@ -33,7 +38,8 @@ function download()
}
])->where([
['user_id', '=', $authUser->id],
['bulan', '=', (str_pad(now()->subMonth()->month, 2, '0', STR_PAD_LEFT))]
['bulan', '=', date('m', strtotime($request->bulan))],
['tahun', '=', $request->tahun]
])->first();
if (!$gaji_pegawai) {
return response()->json([
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment