attributes['file'] = end($file); } function getFileAttribute($value): string { if ($this->bdr_id === null) { $file = asset("storage/$this->tipe/presensi/$this->periode/$value"); } else { $file = config('baseUri.presensi') . "storage/izin/" . $value; } return $file; } function setFileLampiranAttribute($value): void { if ($value === null) { $this->attributes['file_lampiran'] = null; return; } $file = explode('/', $value); $this->attributes['file_lampiran'] = end($file); } function getFileLampiranAttribute($value): ?string { if ($value === null) { return null; } if ($this->bdr_id === null) { return asset("storage/$this->tipe/presensi/$this->periode/$value"); } return config('baseUri.presensi') . "storage/izin/" . $value; } function getKategoriAttribute($value): string { if ($this->periode < Periode::where('status', true)->first()->id_periode) { return $value; } $dawaiService = new DawaiService(); $kategoris = collect($dawaiService->listStatusPresensi()); return $kategoris->where('id', $value)->first()['nama']; } function pegawai() { return $this->belongsTo(Pegawai::class, 'nip', 'nip'); } function logs() { return $this->morphMany(LogPengajuan::class, 'logable'); } function notes() { return $this->morphMany(CatatanPengajuan::class, 'noteable'); } }