getClientOriginalExtension(); $typeFile = self::getEnv(); switch ( $processName ) { case 'dokumen' : $fileName = 'Dokumen_'.date('Ymd')."_".date('His').'.'.$ext; Storage::putFileAs($typeFile . '/dokumen', $file, $fileName); $disk = '/dokumen/' . $fileName; break; case 'meeting': $fileName = 'dok_'.date('Ymd')."_".date('His').'.'.$ext; Storage::putFileAs($typeFile . '/dokumen', $file, $fileName); $disk = '/dok_meeting/' . $fileName; break; case 'logo': $fileName = 'Logo_'.date('Ymd')."_".date('His').'.'.$ext; Storage::putFileAs($typeFile . '/gallery', $file, $fileName); $disk = '/gallery/' . $fileName; break; case 'profile': $fileName = 'User_'.date('Ymd')."_".date('His').'.'.$ext; Storage::putFileAs($typeFile . '/gallery', $file, $fileName); $disk = '/gallery/' . $fileName; break; case 'client': $fileName = 'Client_'.date('Ymd')."_".date('His').'.'.$ext; Storage::putFileAs($typeFile . '/gallery', $file, $fileName); $disk = '/gallery/' . $fileName; break; case 'user': $fileName = 'User_'.date('Ymd')."_".date('His').'.'.$ext; Storage::putFileAs($typeFile . '/gallery', $file, $fileName); $disk = '/gallery/' . $fileName; break; } return $disk; } public static function checkFileIfExists($urlDoc) { $typeFile = self::getEnv(); return Storage::exists($typeFile . $urlDoc); } public static function deleteFile($urlDoc) { if (self::checkFileIfExists($urlDoc)) { $typeFile = self::getEnv(); Storage::delete($typeFile . $urlDoc); } } public static function getFile($urlDoc, $expiredTime = null) { $typeFile = self::getEnv(); $expiredTime = is_null($expiredTime) ? now()->addDay(1) : $expiredTime; return Storage::temporaryUrl($typeFile . $urlDoc, $expiredTime); } public static function downloadFile($urlDoc) { $typeFile = self::getEnv(); return Storage::download($typeFile . $urlDoc); } }