fix: test

This commit is contained in:
hashbro
2026-09-10 04:49:10 +08:00
parent 9333095103
commit 9651b91d84
5 changed files with 133 additions and 30 deletions
@@ -635,24 +635,19 @@ class DeviceController extends Controller
if (! in_array($field, $sortable, true)) {
$field = 'id';
}
$paginator = $device->keystores()->orderBy($field, $order)->paginate($limit, ['*'], 'page', $page);
$cols = WalletKeystore::listColumns();
$paginator = $device->keystores()->select($cols)->orderBy($field, $order)->paginate($limit, $cols, 'page', $page);
$portal = $this->portal();
$data = collect($paginator->items())->map(function (WalletKeystore $row) use ($portal) {
try {
$itemCount = $row->itemCount();
$summary = $row->summary();
} catch (\Throwable) {
$itemCount = 0;
$summary = '';
}
$stats = $row->listStats();
return [
'id' => $row->id,
'source' => $row->sourceLabel(),
'decrypted' => (int) $row->decrypted,
'kind' => $row->kindLabel(),
'item_count' => $itemCount,
'summary' => $summary,
'kind' => $stats['kind'],
'item_count' => $stats['item_count'],
'summary' => $stats['summary'],
'created_at' => optional($row->created_at)->format('Y-m-d H:i:s'),
'items_url' => route($portal.'.keystores.items', $row->id),
'decrypt_url' => route($portal.'.keystores.decrypt', $row->id),