Perbaikan Request Pengajuan Absen Tugas Dinas
This commit is contained in:
@@ -14,17 +14,18 @@ class AbsenResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
// siska_id & file_lampiran hanya relevan untuk tugas dinas (kategori 2).
|
||||
$tugasDinas = (int) $this->getRawOriginal('kategori') === 2;
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'tanggal' => $this->tanggal_mulai,
|
||||
'tanggal_selesai' => $this->tanggal_selesai,
|
||||
'kategori' => $this->kategori,
|
||||
'keterangan' => $this->keterangan,
|
||||
'status' => $this->status,
|
||||
'alasan' => $this->notes?->last()?->message,
|
||||
'bukti' => $this->file,
|
||||
'siska_id' => $this->siska_id,
|
||||
'file_lampiran' => $this->file_lampiran,
|
||||
'siska_id' => $this->when($tugasDinas, $this->siska_id),
|
||||
'file_lampiran' => $this->when($tugasDinas, $this->file_lampiran),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user