feat:앱버전 슈퍼관리자 소프트삭제 목록 표시, 복구/영구삭제 기능

- 슈퍼관리자: 삭제된 항목 빨간 배경으로 표시, 복구/영구삭제 버튼
- 소프트 삭제 시 APK 파일 유지, 영구 삭제 시에만 파일 제거
- restore, forceDestroy 라우트 및 서비스 메서드 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-30 22:39:19 +09:00
parent a0ec103614
commit daaa77badc
4 changed files with 107 additions and 31 deletions

View File

@@ -12,10 +12,15 @@ class AppVersionService
/**
* 버전 목록 (페이지네이션)
*/
public function list(int $perPage = 20): LengthAwarePaginator
public function list(bool $withTrashed = false, int $perPage = 20): LengthAwarePaginator
{
return AppVersion::orderByDesc('version_code')
->paginate($perPage);
$query = AppVersion::orderByDesc('version_code');
if ($withTrashed) {
$query->withTrashed();
}
return $query->paginate($perPage);
}
/**
@@ -49,17 +54,37 @@ public function toggleActive(int $id): AppVersion
}
/**
* 삭제
* 삭제 (소프트)
*/
public function destroy(int $id): void
{
$version = AppVersion::findOrFail($id);
$version->delete();
}
/**
* 복구
*/
public function restore(int $id): AppVersion
{
$version = AppVersion::onlyTrashed()->findOrFail($id);
$version->restore();
return $version;
}
/**
* 영구 삭제
*/
public function forceDestroy(int $id): void
{
$version = AppVersion::onlyTrashed()->findOrFail($id);
// APK 파일 삭제
if ($version->apk_path && Storage::disk('app_releases')->exists($version->apk_path)) {
Storage::disk('app_releases')->delete($version->apk_path);
}
$version->delete();
$version->forceDelete();
}
}