$ this-> table () Throws [InvalidArgumentException] String must be an array or a TableSeparator instance
I wrote an L4 Command class, but the output is table
throwing an exception.
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class Table extends Command {
protected $name = 'table';
public function fire()
{
//output table;
$header = ['Name', 'Email', 'Age'];
$row = ['Luke', 'me@email.uk', '99'];
$this->info(sprintf("is array ? %s", is_array($row) ? 'true' : 'false'));
//outputs is array ? true
$this->table($header, $row);
//throws exception
// [InvalidArgumentException]
// A row must be an array or a TableSeparator instance.
}
}
Any ideas?
+3
source to share