Skip to content

Commit 88ea76e

Browse files
committed
ITT: TableOutput command added.
1 parent d2641ab commit 88ea76e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
use Illuminate\Console\Command;
4+
5+
class TableOutputCommand extends Command
6+
{
7+
protected $signature = 'table-output';
8+
9+
public function handle()
10+
{
11+
$rows = $this->getRows();
12+
$headers = array_keys($rows[0]);
13+
$this->table($headers, $rows);
14+
}
15+
16+
private function getRows()
17+
{
18+
return [
19+
['Date' => '2016-12-13 13:13:13', 'System' => 'Alpha', 'Status' => 'Enabled'],
20+
['Date' => '2016-12-14 14:14:14', 'System' => 'Beta', 'Status' => 'Enabled'],
21+
['Date' => '2016-12-15 15:15:15', 'System' => 'Gamma', 'Status' => 'Disabled'],
22+
];
23+
}
24+
}

tests/fixture/app/Console/Kernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ class Kernel extends \Orchestra\Testbench\Console\Kernel
44
{
55
protected $commands = [
66
GenericCommand::class,
7+
TableOutputCommand::class,
78
];
89
}

0 commit comments

Comments
 (0)