style: Laravel Pint 코드 포맷팅 적용
- PSR-12 스타일 가이드 준수 - 302개 파일 스타일 이슈 자동 수정 - 코드 로직 변경 없음 (포맷팅만)
This commit is contained in:
@@ -14,17 +14,17 @@ public static function saveFiles($files, string $table, string $t_id, string $t_
|
||||
$randomName = bin2hex(random_bytes(16));
|
||||
$fileType = $file->getClientMimeType();
|
||||
$fileSize = $file->getSize();
|
||||
//$tempFile = $file->getPathname();
|
||||
// $tempFile = $file->getPathname();
|
||||
|
||||
$folder = config('custom.data_path') . substr($t_id, 0, 6) . "/";
|
||||
$targetPath = $folder . $randomName;
|
||||
$folder = config('custom.data_path').substr($t_id, 0, 6).'/';
|
||||
$targetPath = $folder.$randomName;
|
||||
|
||||
if (!is_dir($folder)) {
|
||||
if (! is_dir($folder)) {
|
||||
mkdir($folder, 0755, true);
|
||||
}
|
||||
|
||||
try {
|
||||
//move_uploaded_file($tempFile, $targetPath);
|
||||
// move_uploaded_file($tempFile, $targetPath);
|
||||
$file->move($folder, $randomName);
|
||||
chmod($targetPath, 0644);
|
||||
|
||||
@@ -58,17 +58,17 @@ public static function uploadFiles($request)
|
||||
$originalName = $file->getClientOriginalName(); // 예: "파일명.jpg"
|
||||
$ext = pathinfo($originalName, PATHINFO_EXTENSION); // 확장자만 추출: "jpg"
|
||||
$userInputName = $request['fileName'][$key] ?? null;
|
||||
$fileName = $userInputName ? $userInputName . '.' . $ext : $originalName;
|
||||
$fileName = $userInputName ? $userInputName.'.'.$ext : $originalName;
|
||||
|
||||
$randomName = bin2hex(random_bytes(16));
|
||||
$fileType = $file->getClientMimeType();
|
||||
$fileSize = $file->getSize();
|
||||
$t_id_type = $request['fileType'][$key] ?? '00';
|
||||
|
||||
$folder = config('custom.data_path') . substr($t_id, 0, 6) . "/";
|
||||
$targetPath = $folder . $randomName;
|
||||
$folder = config('custom.data_path').substr($t_id, 0, 6).'/';
|
||||
$targetPath = $folder.$randomName;
|
||||
|
||||
if (!is_dir($folder)) {
|
||||
if (! is_dir($folder)) {
|
||||
mkdir($folder, 0755, true);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public static function uploadFiles($request)
|
||||
$file->move($folder, $randomName);
|
||||
chmod($targetPath, 0644);
|
||||
|
||||
if (!empty($file_no)) {
|
||||
if (! empty($file_no)) {
|
||||
self::deleteFiles(['f_id' => $file_no]);
|
||||
}
|
||||
// 신규 파일 등록
|
||||
@@ -95,12 +95,12 @@ public static function uploadFiles($request)
|
||||
}
|
||||
}
|
||||
|
||||
}else if($file_no) {
|
||||
} elseif ($file_no) {
|
||||
|
||||
// 기존파일인데 업로드 파일이 없을경우 이름과 타입만 변경
|
||||
if ($request['fileName'][1]) {
|
||||
$ext = pathinfo(DB::table('SITE_FILES')->where('F_NO', $file_no)->value('F_NAME'), PATHINFO_EXTENSION);
|
||||
$data['F_NAME'] = $request['fileName'][1] . '.' . $ext;
|
||||
$data['F_NAME'] = $request['fileName'][1].'.'.$ext;
|
||||
}
|
||||
|
||||
if ($request['fileType'][1]) {
|
||||
@@ -109,6 +109,7 @@ public static function uploadFiles($request)
|
||||
|
||||
DB::table('SITE_FILES')->where('F_NO', $file_no)->update($data);
|
||||
}
|
||||
|
||||
return self::getFiles($request);
|
||||
}
|
||||
|
||||
@@ -128,7 +129,7 @@ public static function getFiles(array $params): array
|
||||
}
|
||||
if ($idx) {
|
||||
$query->whereIn('SF.T_ID', explode(',', $idx));
|
||||
}else if ($com_no) {
|
||||
} elseif ($com_no) {
|
||||
$query->where('SF.T_ID', $com_no);
|
||||
}
|
||||
if ($tType) {
|
||||
@@ -148,7 +149,7 @@ public static function deleteFiles(array $params): string
|
||||
|
||||
if ($table && $t_id) {
|
||||
$query->where('TABLE', $table)->where('T_ID', $t_id);
|
||||
} else if ($f_id) {
|
||||
} elseif ($f_id) {
|
||||
$query->whereIn('F_NO', explode(',', $f_id));
|
||||
} else {
|
||||
return 'Error';
|
||||
@@ -160,7 +161,7 @@ public static function deleteFiles(array $params): string
|
||||
return 'Success';
|
||||
}
|
||||
foreach ($files as $file) {
|
||||
$filePath = config('custom.data_path') . substr($file->T_ID, 0, 6) . "/" . $file->R_NAME;
|
||||
$filePath = config('custom.data_path').substr($file->T_ID, 0, 6).'/'.$file->R_NAME;
|
||||
if (file_exists($filePath)) {
|
||||
unlink($filePath);
|
||||
}
|
||||
@@ -178,10 +179,12 @@ public static function findFile(array $params): ?array
|
||||
$query = DB::table('SITE_FILES as SF')
|
||||
->select('F_NAME', 'T_ID', 'F_TYPE', DB::raw("IFNULL((SELECT COM_NAME FROM COMPANY_INFO CI WHERE SF.T_ID = CI.COM_NO AND SF.TABLE = 'COMPANY_INFO' LIMIT 1), '') as COM_NAME"));
|
||||
|
||||
if($F_NO) $query->where('F_NO', $F_NO);
|
||||
else $query->where('R_NAME', $fileName)->first();
|
||||
if ($F_NO) {
|
||||
$query->where('F_NO', $F_NO);
|
||||
} else {
|
||||
$query->where('R_NAME', $fileName)->first();
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user