frefactor(daftar-pustaka): replace manual file handling with Laravel Storage

This commit is contained in:
majid
2025-07-08 14:17:45 +07:00
parent 6bb13dbcaf
commit 05f87f4767

View File

@@ -80,14 +80,10 @@ class DaftarPustakaService
$today = now(); $today = now();
$folderPath = 'daftar_pustaka/' . $today->format('Y/m/d'); $folderPath = 'daftar_pustaka/' . $today->format('Y/m/d');
if (!file_exists(public_path($folderPath))) {
mkdir(public_path($folderPath), 0755, true);
}
$fileName = $file->getClientOriginalName(); $fileName = $file->getClientOriginalName();
$file->move(public_path($folderPath), $fileName); $filePath = $file->storeAs($folderPath, $fileName, 'public');
return $folderPath . '/' . $fileName; return $filePath;
} }