Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Allow appending of rows to Artisan tables #31426

Merged

Conversation

@adam-prickett
Copy link
Contributor

adam-prickett commented Feb 11, 2020

As a fix to the issue @freekmurze raised (laravel/ideas#2064) on using appendRow() on a Table within Artisan commands, this PR enables that feature by passing a ConsoleSectionOutput to the Table constructor, thus creating a new section.

The Table instance is also now returned following render, which allows appendRow() to be called on the rendered table.

Example:

public function handle()
{
    $table = $this->table(
        ['Column', 'Another column'],
        []
    );

    $table->appendRow(['Value', 'Another Value']);
    $table->appendRow(['Value', 'Another Value']);
}

Output:

+--------+----------------+
| Column | Another column |
+--------+----------------+
| Value  | Another Value  |
| Value  | Another Value  |
+--------+----------------+
…pendRow() to be used
@GrahamCampbell GrahamCampbell changed the title Allow appending of rows to Artisan tables [6.x] Allow appending of rows to Artisan tables Feb 11, 2020
@freekmurze

This comment has been minimized.

Copy link
Contributor

freekmurze commented Feb 11, 2020

@adam-prickett Thank you for this 👍

@taylorotwell taylorotwell merged commit 3422a24 into laravel:6.x Feb 11, 2020
2 checks passed
2 checks passed
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@adam-prickett adam-prickett deleted the adam-prickett:enable-appendrow-for-artisan-table branch Feb 11, 2020
@taylorotwell

This comment has been minimized.

Copy link
Member

taylorotwell commented Feb 14, 2020

We may have to revert this. It's been a pretty big disaster and headache ever since just to appease this one small use case. Breaking the build on master branch now because of failure to implement some stream methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.