update rm deadcode

This commit is contained in:
baodev0
2026-09-27 11:42:40 +07:00
parent 82a71244ca
commit 3af59bd9c5
129 changed files with 5194 additions and 2698 deletions
@@ -64,7 +64,7 @@ class AdminTransactionController extends Controller
'type' => $t->type,
'status' => $t->status,
'status_label' => TransactionStatus::from((int) $t->status)->label(),
'proof_image' => $t->proof_image ? Storage::disk('public')->url($t->proof_image) : null,
'proof_image' => $t->proof_image_urls[0] ?? null,
'created_at' => $t->created_at?->toISOString(),
'customer' => $t->customer ? [
'uuid' => $t->customer->uuid,
@@ -287,4 +287,21 @@ class AdminTransactionController extends Controller
'message' => 'Đã từ chối giao dịch',
]);
}
public function proofImage(Transaction $transaction, int $index = 0)
{
abort_unless($transaction->proof_image, 404);
$paths = json_decode((string) $transaction->proof_image, true);
$paths = is_array($paths) ? array_values($paths) : [$transaction->proof_image];
$path = $paths[$index] ?? null;
abort_unless(is_string($path) && $path !== '', 404);
$disk = Storage::disk('local')->exists($path) ? 'local' : 'public';
abort_unless(Storage::disk($disk)->exists($path), 404);
return Storage::disk($disk)->response($path, null, ['Cache-Control' => 'private, no-store']);
}
}