Skip to content

Commit

Permalink
Use ConsoleSectionOutput for new Table and return instane to allow ap…
Browse files Browse the repository at this point in the history
…pendRow() to be used (#31426)
  • Loading branch information
adam-prickett authored Feb 11, 2020
1 parent e59597f commit 3422a24
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Illuminate/Console/Concerns/InteractsWithIO.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ public function choice($question, array $choices, $default = null, $attempts = n
* @param \Illuminate\Contracts\Support\Arrayable|array $rows
* @param string $tableStyle
* @param array $columnStyles
* @return void
* @return \Symfony\Component\Console\Helper\Table
*/
public function table($headers, $rows, $tableStyle = 'default', array $columnStyles = [])
{
$table = new Table($this->output);
$table = new Table($this->output->getOutput()->section());

if ($rows instanceof Arrayable) {
$rows = $rows->toArray();
Expand All @@ -235,6 +235,8 @@ public function table($headers, $rows, $tableStyle = 'default', array $columnSty
}

$table->render();

return $table;
}

/**
Expand Down
10 changes: 10 additions & 0 deletions src/Illuminate/Console/OutputStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,14 @@ public function isDebug()
{
return $this->output->isDebug();
}

/**
* Get the underlying Symfony output implementation.
*
* @return \Symfony\Component\Console\Output\OutputInterface
*/
public function getOutput()
{
return $this->output;
}
}

0 comments on commit 3422a24

Please sign in to comment.