Perbaikan Absen Tugas Dinas
This commit is contained in:
@@ -33,12 +33,23 @@ class PengajuanPresensi extends Model
|
||||
|
||||
function setFileAttribute($value): void
|
||||
{
|
||||
// Link eksternal (mis. Google Drive pada tugas dinas) disimpan utuh.
|
||||
if (str_starts_with((string) $value, 'http')) {
|
||||
$this->attributes['file'] = $value;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$file = explode('/', $value);
|
||||
$this->attributes['file'] = end($file);
|
||||
}
|
||||
|
||||
function getFileAttribute($value): string
|
||||
{
|
||||
if (str_starts_with((string) $value, 'http')) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ($this->bdr_id === null) {
|
||||
$file = asset("storage/$this->tipe/presensi/$this->periode/$value");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user