refactor: use builtin table function to display table

This commit is contained in:
b1ek 2024-09-17 22:53:14 +10:00
parent e494bb0f5f
commit 7eae435a50
Signed by: blek
GPG Key ID: A622C22C9BC616B2
1 changed files with 5 additions and 3 deletions

View File

@ -29,10 +29,12 @@ class ShowUsers extends Command
$page = (int) $this->argument('page');
$users = User::all()->forPage($page, 20)->all();
$this->info("Listing all users for page $page");
$this->info("Id\tName\tBalance");
$rows = [];
foreach ($users as $user) {
$this->info($user->id . ":\t" . $user->name . "\t" . $user->balance);
}
array_push($rows, [$user->id, $user->name, $user->balance]);
}
$this->info("Listing all users for page $page");
$this->table([ 'ID', 'Name', 'Balance' ], $rows);
}
}