refactor: use builtin table function to display table
This commit is contained in:
parent
e494bb0f5f
commit
7eae435a50
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue