frefactor(daftar-pustaka): replace manual file handling with Laravel Storage
This commit is contained in:
@@ -80,14 +80,10 @@ class DaftarPustakaService
|
||||
$today = now();
|
||||
$folderPath = 'daftar_pustaka/' . $today->format('Y/m/d');
|
||||
|
||||
if (!file_exists(public_path($folderPath))) {
|
||||
mkdir(public_path($folderPath), 0755, true);
|
||||
}
|
||||
|
||||
$fileName = $file->getClientOriginalName();
|
||||
$file->move(public_path($folderPath), $fileName);
|
||||
$filePath = $file->storeAs($folderPath, $fileName, 'public');
|
||||
|
||||
return $folderPath . '/' . $fileName;
|
||||
return $filePath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user