Files
sam-manage/app/Http/Controllers/ArchivedRecordController.php

47 lines
1.3 KiB
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers;
use App\Services\ArchivedRecordService;
use Illuminate\View\View;
class ArchivedRecordController extends Controller
{
public function __construct(
private readonly ArchivedRecordService $archivedRecordService
) {}
/**
* 아카이브 레코드 목록 (Blade 화면만)
*/
public function index(): View
{
$deletedByUsers = $this->archivedRecordService->getDeletedByUsers();
return view('archived-records.index', compact('deletedByUsers'));
}
/**
* 아카이브 레코드 상세 보기 (batch 기준)
*/
public function show(string $batchId): View
{
$records = $this->archivedRecordService->getRecordsByBatchId($batchId);
if ($records->isEmpty()) {
abort(404, '아카이브 레코드를 찾을 수 없습니다.');
}
// 첫 번째 레코드에서 batch 정보 추출
$batchInfo = [
'batch_id' => $batchId,
'batch_description' => $records->first()->batch_description,
'deleted_by' => $records->first()->deletedByUser?->name ?? '-',
'deleted_at' => $records->first()->deleted_at,
'record_count' => $records->count(),
];
return view('archived-records.show', compact('records', 'batchInfo'));
}
}